Skip to content

zalmoxisus/redux-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redux Notify

Redux middleware to notify when an action from the list is dispatched.

Demo

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.

Examples

About

Notify when specified redux actions are dispatched.

Resources

License

Stars

Watchers

Forks

Packages

No packages published