Created
December 7, 2011 22:10
-
-
Save meirish/1444943 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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