Skip to content

Instantly share code, notes, and snippets.

@bsudekum
Created January 23, 2013 18:39
Show Gist options
  • Save bsudekum/4611406 to your computer and use it in GitHub Desktop.
Save bsudekum/4611406 to your computer and use it in GitHub Desktop.
Backbone Stuff
Map = Backbone.Model.extend({
initialize:function(mapUnits) {
console.log("init maps : "+mapUnits.id);
console.log("init maps : "+mapUnits.maxzoom);
}
});
mapList = Backbone.Collection.extend({
model: Map,
sync: function(method, model, options) {
var params = _.extend({
type: 'GET',
dataType: 'jsonp',
url: model.url(),
processData: false
}, options);
return $.ajax(params);
},
parse: function(response) {
return response;
},
url: function() {
return "http://api.tiles.mapbox.com/v3/bobbysud/tilesets.json";
}
});
s=new mapList();
s.bind("reset",function(collection) {
console.log(collection.models);
});
s.fetch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment