zalmoxisus / Redux Notify
Licence: mit
Notify when specified redux actions are dispatched.
Stars: ✭ 19
Programming Languages
javascript
184084 projects - #8 most used programming language
Redux Notify
Redux middleware to notify when an action from the list is dispatched.
Usage
Specify actions to catch, and which actions to trigger:
const notifyEvents = [
{
catch: [INCREMENT_COUNTER, DECREMENT_COUNTER],
dispatch: sendNotification
}
];
Then just include it as a redux middleware:
import notify from 'redux-notify';
const store = applyMiddleware(notify(notifyEvents))(createStore)(reducer);
API
notify(notifyEvents, [config])
- arguments
-
notifyEvents an array of objects:
- catch - an array of action objects, which trigger dispatching of actions specified in the dispatch parameter.
- dispatch - an array of action creators (functions) or just an action creator (function) to be dispatched after the actions in the catch parameter.
-
config object (optional)
- noReverse boolean - prevents triggering the action back, when having cyclic dispatching.
-
notifyEvents an array of objects:
Examples
- counter example - notifications examples with react-notification-system and react-toolbox snackbar.
-
browser-redux - a chrome extension example, which uses
redux-notify
for messaging between content scripts and background page.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].