fluxify icon indicating copy to clipboard operation
fluxify copied to clipboard

Store mixins?

Open ducman opened this issue 9 years ago • 2 comments

Anyway I can add common functions to a store so that I can use them inside the actionCallbacks?

ducman avatar Jan 26 '16 01:01 ducman

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.

arqex avatar Jan 26 '16 16:01 arqex

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
}

ducman avatar Jan 28 '16 17:01 ducman