syntagme.js
Syntagme is a flux's flamework.
Installation
bower install --save syntagme
npm:
npm install --save syntagme
Example
Simplest case
const app = app app app app appaction'INCREMENT'console // 2
Promise on ActionCreator
const app = app appapp app appaction'FETCH' type: 'greeting'
Documentation
app.listen()
Subscribe to state and start executing dispatcher. If dispatch is executed before listen, it gets an error.
app.subscribe(listener: (state) => void)
Subscribe to store updates.
listener
is executed when state is updated.
app.reducer(reducer: (payload, state) => (state | null))
Register the reducer. Reducers are executed in the order in which they are registered.
If you do not return the new state, subscribe will not be executed.
app.actionCreator(type: ActionType, actionCreator: () => Promise | null)
Register the ActionCreator. Dispatch the evaluation result of the specified function as Action.
When returning Promise, _RESOLVE
when resolving, and _REJECT
when rejecting are combined with type and dispatched.
app.action(type: ActionType, args)
Dispatch the ActionCreator registered based on type.
An error occurs if you specify an unregistered ActionType.
License
MIT