Created
February 9, 2017 17:08
-
-
Save back2dos/17e165019c23820063155c402ed293be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Container<Action, State> { | |
var state:tink.state.State<State>; | |
var reducer:State->Action->State; | |
public function new(initial, reducer) { | |
this.state = new State(initial); | |
this.reducer = reducer; | |
} | |
public function dispatch(action:Action) | |
state.set(reducer(state.value, action)); | |
public function bind(?options, cb) | |
return state.observe().bind(cb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment