/var/log

Tag: Backbone

Titanium, Backbone and Promises

An easy way to let Backbone work with Promises in Titanium: Get the bluebird Promise library. Now you can add a fetchAsPromise to the Backbone.Model.Prototype and Backbone.Collection.prototype objects: Backbone.Model.prototype.fetchAsPromise = function(options) { var me = this; return new Promise(function(resolve, reject) { options.success = resolve; options.error = reject; me.fetch(options); }); }; The same can be done […]

Backbone in Titanium

Using Backbone in Titanium Alloy is a very powerful mechanism but it can backfire on you if you don't take into account how it works. Remove event listeners from singletons A common pattern is to create a singleton when a window opens and attach a change event handler to the model so the views will update when […]