Skip to content

Instantly share code, notes, and snippets.

@meirish
Created December 7, 2011 22:10
Show Gist options
  • Save meirish/1444943 to your computer and use it in GitHub Desktop.
Save meirish/1444943 to your computer and use it in GitHub Desktop.
reset: function(){
var funcs = [],
self = this,
jsons = [
['default-widgets.json', Widgets, 'default-widgets'],
//['audio.json', AudioList, 'audio'],
['departures.json', Locations, 'departures'],
['destinations.json', Locations, 'destinations'],
['stops.json', Locations, 'stops'],
['trends.json', Trends, 'trends'],
];
_.each(amplify.store(), function( val, key, obj ){
amplify.store( key, null );
});
_.each(jsons, function( ele, i, list){
funcs[i] = function() {
$.getJSON(ele[0], function(data){
var coll = new ele[1](data, {store: ele[2]});
coll.each(function(model){
model.save();
});
});
}
});
$.when( _.each(funcs, function(func){ return func(); }) )
.then( function(){ self.navigate('', true); });
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment