event-emitter-middleware
v0.0.3
Published
A redux middleware module for emitting action events to eventlisteners outside of your application.
Downloads
1
Readme
event-emitter-middleware for use in Redux store
A redux middleware module for emitting action events to event listeners outside of your application.
https://github.com/OscarBakker/event-emitter-middleware
Add createEventEmitterMiddleware to your store with applyMiddleware, example:
const actions = [
'IS_SOLVED',
'PAUSE_TIMER',
];
const eventEmitterMiddleware = createEventEmitterMiddleware(actions);
const enhancer = composeWithDevTools(applyMiddleware(
thunkMiddleWare,
eventEmitterMiddleware
));
const store = createStore(persistedReducer, {}, enhancer);
// Then in another app in the same window can listen listen to these action events.
window.addEventListener('IS_SOLVED', customEventHandler);