fluxify
fluxify copied to clipboard
Store mixins?
Anyway I can add common functions to a store so that I can use them inside the actionCallbacks?
You can create those helper functions outside the store, but in the same file than the store. That would prevent those private functions to be called from outside the store's action callbacks.
From what you described, it would seem those functions be public not private. Maybe you can provide an example? Right now I'm doing the below (which works) but it still not that great. My js is still pretty weak.
var myStore = flux.createStore({...});
myStore['myMixinFunction'] = function() {
// do stuff ... not sure how to call 'anotherOne' inside this function
}
myStore['anotherOne'] = function() {
// do stuff
}