0.2.0 • Published 8 years ago

redux-notify v0.2.0

Weekly downloads
43
License
MIT
Repository
github
Last release
8 years ago

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