Store enhancer for redux which allows listening of dispatched actions.
Usagenpm install --save redux-dispatch-subscribe
The dispatchSubscribe
store enhancer add a addDispatchListener
to your Redux store. The dispatch listener of called after regular store listeners. Since dispatchSubscribe
overloads the dispatch on the original redux store it is important that it gets applied before any other store enhancers or middleware that depend on these functions; The compose utility in redux can be used to handle this:
import { createStore, applyMiddleware, compose } from 'redux';
import { dispatchSubscribe } from 'redux-dispatch-subscribe';
Â
const enhancer = compose(
  applyMiddleware(...middleware),
  dispatchSubscribe((notify) => {
    notify();
  })
)
Â
const store = createStore(reducer, initialState, enhancer);
Note: since compose
applies functions from right to left, dispatchSubscribe
should appear at the end of the chain.
Implementation is inspired from redux-batched-subscribe.
Package Sidebar Installnpm i redux-dispatch-subscribe
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4