Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default (reducer, state = reducer(reducer._, {}), listeners = []) => ({
- dispatch(action){
- state = reducer(state, action)
- listeners.map(listener => listener(state))
- },
- subscribe: f => (
- listeners.push(f), i => listeners.splice(i = listeners.indexOf(f), !!~i)
- ),
- getState: () => state
- })
Add Comment
Please, Sign In to add comment