Coder Social home page Coder Social logo

redux-notify's Introduction

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

redux-notify's People

Contributors

zalmoxisus avatar sokratisvidros avatar

Stargazers

Ali Torki avatar Saviio avatar Brad Pillow avatar George Avgenakis avatar Bhargav Ponnapalli avatar Michael Mior avatar Hoetmaaiers avatar Vesa Vänskä avatar Vladimir Luss avatar Jack Ketcham avatar Stephan Schneider avatar Yannick avatar Aaron Harvey avatar Reinaldo Schiehll avatar Patrick Lienau avatar Gustavo Marin avatar Agon Bina avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.