Registry / web-framework / redux-timer-middleware

redux-timer-middleware

JSON →
library1.0.0jsnpmunverified

A simple Redux middleware to periodically dispatch actions. Version 1.0.0, no recent updates. Enables starting and stopping named timers via Redux actions, with optional payload, interval, and end-period. No dependencies beyond Redux. Lightweight compared to more complex saga/observable-based solutions.

npm install redux-timer-middleware
INSTALL
IMPORT
SIG · REDUX-TIMER-MIDDLE
R
redux-timer-middleware
web-frameworkjavascriptv1.0.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.

timerMiddleware
import timerMiddleware from 'redux-timer-middleware'
import { timerMiddleware } from 'redux-timer-middleware'
Default export, not named.
START_TIMER
import { START_TIMER } from 'redux-timer-middleware'
import START_TIMER from 'redux-timer-middleware'
Named export for action type constant.
STOP_TIMER
import { STOP_TIMER } from 'redux-timer-middleware'
import STOP_TIMER from 'redux-timer-middleware'
Named export for action type constant.

Shows how to set up redux-timer-middleware, start an infinite timer, and stop it.

import { createStore, applyMiddleware } from 'redux'; import timerMiddleware, { START_TIMER, STOP_TIMER } from 'redux-timer-middleware'; const reducer = (state = {}, action) => state; const store = createStore(reducer, applyMiddleware(timerMiddleware)); // Start infinite timer dispatching 'TICK' every second store.dispatch({ type: START_TIMER, payload: { actionName: 'TICK', timerName: 'myTimer' } }); // Later stop it store.dispatch({ type: STOP_TIMER, payload: { timerName: 'myTimer' } });
Debug
Known issues
gotchatimerName is required for both START_TIMER and STOP_TIMER, but no validation is performed; missing it may cause silent failures.
fix
Always provide a unique timerName string.
affects: 1.0.0
gotchatimerPeriod counts ticks, not milliseconds; setting timerPeriod: 10 dispatches actionName 10 times (once per interval) then dispatches `actionName + '_END'`.
fix
Use timerInterval (in ms) to control tick speed; timerPeriod controls number of ticks.
affects: 1.0.0
gotchaThe middleware does not clean up timers on store unsubscribe; may cause memory leaks if store is recreated.
fix
Manually stop all timers before creating a new store or use a cleanup mechanism.
affects: 1.0.0
Errors
Common errors & fixes
Uncaught TypeError: Cannot read properties of undefined (reading 'apply')
timerMiddleware is a function, but must be applied with applyMiddleware correctly.
fix
import { createStore, applyMiddleware } from 'redux'; createStore(reducer, applyMiddleware(timerMiddleware));
TypeError: actionName is not a string
Missing or non-string actionName in START_TIMER payload.
fix
Ensure payload.actionName is a string like 'MY_ACTION'.
Uncaught ReferenceError: START_TIMER is not defined
Using named import incorrectly or forgetting to import constants.
fix
import { START_TIMER } from 'redux-timer-middleware';
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
reduxrequiredPeer dependency, middleware works with Redux store
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
redux-timer-middleware — npm install redux-timer-middleware · libregistry