Last active
February 13, 2023 02:12
-
-
Save threepointone/43f16389fd96561a8b0b to your computer and use it in GitHub Desktop.
sto alternate api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// store.js | |
let {store, handler} = sto(initialState, reduceFn); // where reduceFn: function(currentState, action, ...args){} | |
dispatcher.register(handler); | |
export store; | |
// elsewhere | |
store.get() // -> current state | |
store.toObservable() // -> to be used with .observe() | |
// that's it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's something I played with: https://gist.github.com/gaearon/c02f3eb38724b64ab812
Let me know your thoughts!