Skip to content

Instantly share code, notes, and snippets.

@systemist
Created October 29, 2015 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save systemist/70ce85c49f070bc995e7 to your computer and use it in GitHub Desktop.
Save systemist/70ce85c49f070bc995e7 to your computer and use it in GitHub Desktop.
let forecasts = new ForecastCollection();
var Store = _.extend({}, Backbone.Events, {
initialize() {
this.listenTo(forecasts, 'add remove change', () => this.trigger('change'));
},
getForecasts() {
return forecasts.toJSON();
},
saveForecast(data) {
return forecasts.create(data);
}
});
Store.initialize();
export default Store;
/*
* in your component
store.saveForecast({
balance: this.refs...
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment