
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.66 KB | hits: 12 | expires: Never
window.ArtistCollection = Backbone.Collection.extend({
initialize: function(models, ops) {
if(ops.updater) {
this.updater = ops.updates;
this.updater.bind('update', _.bind(this.onUpdater, this));
}
},
onUpdater: function(response) {
// send the updates to the correct model
// id. Maybe even as a parse args if its
// in full model json
}
});
// then just
var popArtists = new ArtistCollection(null, {updater: window.fayeClient});
var trackedArtists = new ArtistCollection(null, {updater: window.fayeClient});
// if this is a common pattern, you could wrap it into a new Backbone base