Skip to content

Instantly share code, notes, and snippets.

Last active February 13, 2023 02:12
What would you like to do?
sto alternate api
// store.js
let {store, handler} = sto(initialState, reduceFn); // where reduceFn: function(currentState, action, ...args){}
export store;
// elsewhere
store.get() // -> current state
store.toObservable() // -> to be used with .observe()
// that's it.
Copy link

just read the part where dispatcher holds state. good idea, need to think it though..

Copy link

export const store = dispatcher.register(initialState, reduceFn);

this changes the register signature, but should be easier to do the above now.

Copy link

gaearon commented May 6, 2015

Here's something I played with:
Let me know your thoughts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment