Message from JavaScript discussions
December 2016
— Two actions cannot fire at the same
If you are mutating the state based on the previous state, read the state with each event that mutates it
— React does that, look for the setState docs
— I am not using react
— I am building a Flux framework
— And I am not solving a grandiose problem, I'm enabling synchronous batched action scripting
— That allows me to invoke as many actions as I want, all at the same time.
— Here it is: http://pastebin.com/mc3dFqj9
— 80 lines exactly, haha
— So easy to use... to add an action you can do
store.addAction(function (state) {
state.helloworld = "Hello World!";
return state;
});
— Or to not update state, simple don't return any data:
store.addAction(function (state) {
console.log(state.helloworld);
});
— And so, it is possible to not have to use the store's Getter if you don't need to break out data.