Skip to content

Instantly share code, notes, and snippets.

@meirish
Created November 16, 2011 16:06
Show Gist options
  • Save meirish/1370485 to your computer and use it in GitHub Desktop.
Save meirish/1370485 to your computer and use it in GitHub Desktop.
define([
'jquery',
'underscore',
'backbone',
'router',
'collections/widget-list',
'amplify'
], function($, _, Backbone, router, WidgetCollection, amplify){
var init = function(){
var defaults = amplify.store('defaults');
if (defaults){
_.each(defaults.split(','), function(key){
amplify.store(key, null);
});
amplify.store('defaults', null);
}
$.getJSON('default-widgets.json', function(data){
var coll = new WidgetCollection(data, {store: 'defaults'});
coll.each(function(model){
model.save();
});
})
}
return {
init: init
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment