API
Dispatcher
const dispatcher = new Dispatcher()
Methods
- subscribeStore(store) - подписать store на получение событий
- dispatch(action) - отправить action в store
Store
const store = new Store(actions, state)
Methods
- sgetState() - получить текущий state
createAction
createAction(action, payload)
Usage
import flux from 'flux-shri'
const dispatcher = new flux.Dispatcher()
const store = new flux.Store(actions, state)
const createAction = flux.createAction
dispatcher.subscribeStore(store)
dispatcher.dispatch(createAction('SET_VOLUME', { volume: 50 }))
unit tests
$ npm i
$ npm test
smart-home