would be nice to have a callback()
medyll opened this issue · comments
medyll commented
something like dispatch({},func) , as in setState
Jhonny Michel commented
Cool ideia. I want to have it implemented! If you'd like to contribute feel free to do so! :) If you don't feel like it, that's fine, I can work on it this week.
medyll commented
I would do something like :
var store = {
state: state,
reducer: reducer,
setState: function setState(action,callback) {
var _this = this;
this.state = this.reducer(this.state, action);
this.setters.forEach(function (setter) {
return setter(_this.state);
});
if(callback) callback(this.state)
},
setters: []
};
and yes, i feel to contribute, will be on it on the next day
Jhonny Michel commented
Implemented on #9