redux-middleware-debounce
FSA-compliant middleware for Redux to debounce actions. Based on redux-debounce
Installation
$ npm install --save redux-middleware-debounce
Usage
Simply add a debounce property to any Flux Standard Action (or any object-based action) like so:
// Store setup const logger = const createMiddleware = const store = reducer const debounceAction = type: 'TEST' debounce: wait: 100
Debounce middleware should be placed near the top of the chain, that way the debounce property will be stripped in time for other middlewares that validate, such as redux-api-middleware
Options
All Lodash debounce() options are supported:
See lodash
const debounceAction = () => ({
type: 'TEST',
debounce: {
wait: 100,
options: {
maxWait: 1000
}
},
})
License
Copyright © 2016 Committed Software
Original examples and test code Copyright © 2015-2016 Neil Kistner. Released under the MIT license. See license for details.