Flexible Flux Implementation
Flexible Flux implementation
Creates a new Action. Returns an Observable/Function.
.listen(onSuccess, onFail)Subscribe to an Action. Returns a function, that will unsubscribe you, once called.
onFailcallback will be called depending on the Action result.
Creates multiple actions based on the provided
spec. Supports sub-actions:
var Actions = Flex
Actions can later be used as:
Note: Action call returns a
Promise, that is resolved with a
function, that will synchronously propagate changes to subscribed Store.
May be used together with
Promise.all() in isomorphic apps.
Creates a new Store. Returns a
initializemethod, it will be used as a
initialStateproperty will be used a Store's initial state.
Store constructor, extend it to create a new Store using ES6 syntax
.getInitialState() Returns Store initial state
.get() Returns current state
stateDiff to the current state and propagates it to Observers.
.reset() Resets state to its original form.
.listen(onData) Subscribes an Observer to Store state changes using
.listenTo(action[, onSuccess, onFail]) Subscribes Store to
action calls. Optional
onFail methods may be used.
>Fail() If no callbacks provided to
.listenTo() method, appropriate Store methods will be used as callbacks.
ActionName is formed as (ParentName + ChildName):
Actions constructor, extend it to create a new Actions using ES6 syntax
Simplifies Component subscription/unsubscription to Store.
.listenTo(store, onData)Subscribes Component to Store changes. Unsubscribes on
store state as a
store and propagates changes to Components. May be used in isomorphic apps.
Runs a sequence of Actions and returns a promise that will be resolved, when they all finish running. Stores will be reseted before resolving the promise. Can be used for serverside rendering.