Category - JavaScript

Service Inheritance in AngularJS using ES6

One of the things that I’ve found is that my Angular services tend to have a lot of duplicate logic in them. The biggest culprit is HTTP calls for CRUD operations. Whether I’m using Restangular, ngResource, or plain ole’ $http, this has been a constant source of un-DRYing in my code. Let’s take a look at using ECMAScript 6’s class […]

Read

Delaying the $digest() cycle in AngularJS

When scaling an AngularJS app, large data sets can cause the $digest() cycle to run slowly. There are a number of performance optimizations you can make, such as being careful with $watch() and $filter(), using one-time binding, or hunting down expensive operations with Batarang. But sometimes, even with these improvements, an app with a lot of data can feel sluggish due to […]

Read

TomDoc for JavaScript?

I love code documentation. Here are some reasons: 1. It reduces cognitive load when maintaining legacy code (helps you figure out which button to press faster). Docs communicate how the code should be working at a specific point in time, and this can reduce debugging time when tracking down a bug. 2. It communicates intent. This helps future developers to respect […]

Read

Three.js tutorial – building an atom

Three.js is a powerful open-source library for 3D modeling and animation using pure JavaScript. This tutorial will cover the basics of working with three.js, and we’ll build an animated atom in the process. Here’s what our end product will look like: For the purposes of keeping this tutorial as simple as possible, we’ll use inline JavaScript in a single HTML […]

Read