Reudux Events Middleware
Redux middleware to enable you to easily dispatch actions in response to other actions in a decoupled manner
Usage
Expects a Promise polyfill to be present
npm install --save redux-events
;
const listeners = // Function to return array of next actions to dispatch const rootListener = // Optional utility class to compose listener functions from different modules let middleware = // apply middleware before others such as redux-thunk or router const store = store // store.dispatch() Always Returns a promise now. The Promise will only be resolved once all other actions provided by the listener function have also resolved
Example Module Listener function
const LISTENERS = // Simply return the next action to dispatch ACTION_TYPE: type: NEXT_ACTION_TYPE id // Or return a redux-thunk to dispatch async requests // Requires redux-thunk middleware ACTION_TYPE: { return Promise } { return LISTENERS }