Registry / storage / redux-storage-decorator-debounce

redux-storage-decorator-debounce

JSON →
library1.1.3jsnpmunverified

Debounce decorator for redux-storage that delays and merges save operations. Version 1.1.3 is the latest stable release; the package is maintained as a fork of the original deprecated project. It wraps any redux-storage engine and defers save calls for a configurable delay, resetting the timer on each new state change. This reduces expensive storage writes by batching them. Requires redux-storage as a peer dependency.

npm install redux-storage-decorator-debounce
INSTALL
IMPORT
SIG · REDUX-STORAGE-DECO
R
redux-storage-decorator-debounce
storagejavascriptv1.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import debounce from 'redux-storage-decorator-debounce'
const debounce = require('redux-storage-decorator-debounce');
Default export is a function that accepts an engine and optional delay. CJS require still works.
createDebounce
import { createDebounce } from 'redux-storage-decorator-debounce'
import createDebounce from 'redux-storage-decorator-debounce'
Named export createDebounce is available; do not confuse with default export.
DebounceDecorator
import { DebounceDecorator } from 'redux-storage-decorator-debounce'
Type import only if using TypeScript; not a runtime export.

Creates a debounced storage engine that delays save by 1500ms.

import { createStore, applyMiddleware } from 'redux'; import storageEngine from 'redux-storage-engine-localstorage'; import debounce from 'redux-storage-decorator-debounce'; const engine = debounce(storageEngine('my-app'), 1500); // Use with redux-storage middleware (assuming you have it configured) // const storageMiddleware = storageMiddleware(engine); // const store = createStore(reducer, applyMiddleware(storageMiddleware));
Debug
Known issues
deprecatedThe original package by michaelcontento is deprecated; this fork is maintained.
fix
Upgrade to 1.1.3 or later.
affects: <=1.1.2
breakingPackage requires redux-storage as a peer dependency; not installing it will cause runtime errors.
fix
Install redux-storage: npm install redux-storage.
affects: >=1.0.0
gotchaThe decorator only delays save; it does not merge multiple saves with different state snapshots. Each call to engine.save overwrites the previous pending save.
fix
Be aware that only the latest state is saved after the debounce period.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'redux-storage'
Missing redux-storage peer dependency
fix
npm install redux-storage
TypeError: engine.save is not a function
Passed an invalid engine (not a redux-storage engine) to debounce
fix
Ensure the first argument is a valid redux-storage engine (e.g., from redux-storage-engine-localstorage).
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies
redux-storagerequiredpeer dependency; this decorator wraps redux-storage engines
Agent activity
20 hits · last 30 days
node
18
Amazon
1
Resources
redux-storage-decorator-debounce — npm install redux-storage-decorator-debounce · libregistry