Created
October 29, 2015 18:05
-
-
Save jacobthemyth/dad84495d4146af0f38e to your computer and use it in GitHub Desktop.
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
import ForecastCollection from './models'; | |
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