Closed jolafrite closed 9 years ago
Hi @jolafrite and thanks for the input!
If I understand you correctly you could just do this:
.store('MyStore', function () {
var store = {
handlers: {}
};
store.handlers[actions.LOAD_CURRENT_USER] = 'onLoadCurrentUser';
return store;
});
In ES6 you can actually do this:
.store('MyStore', function () {
return = {
handlers: {
[actions.LOAD_CURRENT_USER]: 'onLoadCurrentUser'
}
};
});
Considering this I do not think it is needed. Seems okay?
Version 2 is so much better, i have to take a longer look at ES6 I will stick to my modification Thanks
Into stores handlers, it would be great to be able to directly access the actions key constant instead of retype the value.
For example :
var store = { handlers: function() var handlers = {}; handlers[actions.LOAD_CURRENT_USER] = 'onLoadCurrentUser'; return handlers; }, };
To make it work I changed your code line 42 :
Store.handlers = ((true === _.isFunction(spec.handlers)) ? spec.handlers() : spec.handlers);
Maybe you have a better way ?