Flux stores inspired by Redux
$ npm install mighty-dux flux --save
Dux exposes two methods for creating stores,
Returns a new instance of a Dux Store. It is passed a flux dispatcher and an object of options.
var Dux = ;var Dispatcher = Dispatcher;var dispatcher = ;var store = Dux;
Returns a class for creating instances of a Dux Store. It is passed an object of options. This is useful for an instances architecture rather than traditional flux singletons.
var Dux = ;var Dispatcher = Dispatcher;var dispatcher = ;var AppStore = Dux;var app = dispatcher;
getInitialState returns the intial state of the store
Action Reducers are reducers that are called on a store when an action matches the action type. Action Reducers are passed the current state object, as well as the matching action. Return the new state object.
var Store = Dux;app;console; // 1
Any other methods or properties have direct access to the store object via the this keyword.
var Store = Dux;
Returns the current state of the store
Resets the state of the store and fires
CHANGE callbacks. This is useful for rehydrating stores on the client in isomorphic applications. This does not reset the event listeners on the store.
The Flux dispatch token for the store. Can be used with
Subscribe to store events. Optionally pass an event type, or subscribe to all events that affect the store.
Unsubscribe callback from Store events. Event Type is also optional
Object of event listeners per store event.
Calls the dispatcher instance's waitFor method.