O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Client-side tracing

When developing an Ember.js or any other MVC application, it may be wise to trace events that occur in the application. Tracing events has the benefit of yielding data that becomes meaningful when presented as graphs. A simple tracer could be implemented by logging the timestamp of predetermined points of an ongoing event. For example, let's create an application that traces progress in loading models from the server:

App.ApplicationRoute = Ember.Route.extend({ trace: function(event){ var timestamp = Date.now(); var data = { timestamp: timestamp, event: event }; Ember.$.ajax('/logs', { type: 'POST', data: data }); }, model: function(){ this.trace('load-application-model'); return this.getJSON('/books'); }, setupController: function(controller, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required