An Introduction to Finding Memory Leaks in Backbone Applications with Chrome Developer Tools

Wednesday, July 2nd, 2014

When it comes to memory management and JavaScript applications using Backbone, you’ll often hear about zombie views and how easy it is to unintentionally create memory leaks. The suggested solution to preventing memory leaks in Backbone applications most often comes down to using .listenTo() as opposed to .on() when setting up views that can respond to model and collection changes. Recently, since I have started working with Backbone again quite a bit at work, I wanted to learn how to find and verify memory leaks in a browser’s developer tools so that I can be more prepared for when I am faced with an application that is having memory problems. Therefore, I set out to build an extremely simple Backbone page to try and answer my own questions.

Read More

JavaScript Flow Control

Friday, June 27th, 2014

Learning how to manage asynchronous code in JavaScript can be challenging. In the browser, asynchronous operations come in the form of AJAX requests and timers. In Node.js, asynchronous operations are typically for I/O operations like reading and writing to the file system, database operations, and HTTP calls. Let’s look at 3 popular ways of handling multiple asynchrounous operations. The examples below are written in Node.js, but the following libraries and techniques also apply to browser JavaScript. We will look at managing control flow using:

Read More

Unit Testing with $httpBackend in Angular.js - Backend Definitions

Monday, January 20th, 2014

In the last post on Request Expectations, we looked at how we can set expectations that certain requests are made. Here we will look at how we can define our backend with fake responses for our unit tests.

Read More

Unit Testing with $httpBackend in Angular.js - Request Expectations

Saturday, January 18th, 2014

So you have an Angular service that communicates with an API, but you’re not really sure how to go about testing it. Maybe you read the documentation on $httpBackend, but you were a little confused by the examples. I know I was. Let’s see how we can set Request Expectations using $httpBackend.

Read More