Created
January 23, 2013 18:39
-
-
Save bsudekum/4611406 to your computer and use it in GitHub Desktop.
Backbone Stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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