Registry / web-framework / redux-listener-middleware

redux-listener-middleware

JSON →
library0.2.0jsnpmunverified

A Redux middleware that listens for and reacts on Flux actions, allowing side-effects and async operations without thunks. Current stable version is 0.2.0, with a small set of releases. It differentiates itself by using rule-based filtering (regex or function) and action transformation before listener invocation, providing a centralized way to handle async flows while keeping reducers pure. Unlike redux-thunk, actions remain plain objects, and listeners are decoupled from action creators. Active development appears to have stalled.

npm install redux-listener-middleware
INSTALL
IMPORT
SIG · REDUX-LISTENER-MID
R
redux-listener-middleware
web-frameworkjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

listen
import listen from 'redux-listener-middleware'
const { listen } = require('redux-listener-middleware')
Default export is a factory function, not a named export.
MiddlewareInstance
const middleware = listen()
new listen()
listen() returns a middleware instance; it is not a constructor.
createListener
middleware.createListener((action, dispatch) => { ... })
listen().createListener(...)
createListener is a method on the returned instance, not static.

Shows setup of middleware, listener with rule that transforms actions before async fetch, and dispatching.

import { createStore, applyMiddleware } from 'redux'; import listen from 'redux-listener-middleware'; const middleware = listen(); middleware.createListener((action, dispatch) => { console.log('Received action:', action.type); if (action.meta && action.meta.async) { fetch(action.payload.url) .then(res => res.json()) .then(data => dispatch({ type: action.type + '_SUCCESS', payload: data })) .catch(err => dispatch({ type: action.type + '_FAIL', payload: err })); } }).addRule(/^FETCH_/, (action) => ({ ...action, payload: { url: `/api/${action.type.slice(6).toLowerCase()}` } })); const reducer = (state = {}, action) => { switch (action.type) { case 'FETCH_USER_SUCCESS': return { ...state, user: action.payload }; default: return state; } }; const store = createStore(reducer, applyMiddleware(middleware)); dispatch({ type: 'FETCH_USER', meta: { async: true } });
Debug
Known issues
gotchaPeer dependency on redux 3.x; not tested with redux 4+.
fix
Use with redux 3.x or upgrade to alternative like redux-saga or redux-observable.
affects: >=0.1.0
deprecatedPackage has not been updated since 2016; no TypeScript definitions, no modern ES module bundling.
fix
Consider using redux-saga, redux-observable, or @reduxjs/toolkit listener middleware.
affects: >=0.0.0
gotchaListener rule transform mutates action (Object.assign) in README example, which may break other middleware or reducers expecting immutability.
fix
Return a new object in rule transform instead of mutating: (action) => ({ ...action, payload: '...' })
affects: >=0.1.0
gotchaNo way to remove a listener once added; memory leak if listeners accumulate.
fix
Plan lifecycle carefully or use middleware that supports dynamic removal.
affects: >=0.1.0
deprecatedPackage appears unmaintained: no repository link in npm, last commit years ago.
fix
Migrate to actively maintained alternatives.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: middleware.createListener is not a function
Importing wrong symbol or not calling listen() factory.
fix
Use: import listen from 'redux-listener-middleware'; const middleware = listen(); then middleware.createListener(...)
Cannot find module 'redux-listener-middleware'
Package not installed or typo in import path.
fix
Run: npm install redux-listener-middleware (note: 'redux' not 'redux')
Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.
Dispatching a function or promise without thunk middleware; listener is not designed to replace thunks entirely for async actions.
fix
Either keep thunk middleware before listener, or ensure async dispatch returns plain objects.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
reduxrequiredPeer dependency; middleware requires Redux store.
Agent activity
4 hits · last 30 days
node
4
Resources
redux-listener-middleware — npm install redux-listener-middleware · libregistry