Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

redux-debounce

Build Status npm Codecov.io

FSA-compliant middleware for Redux to debounce actions.

Installation

$ npm install --save redux-debounce

Usage

// Store setup
import { applyMiddleware, createStore } from 'redux'
import createDebounce from 'redux-debounce'
import createLogger from 'redux-logger'
import promise from 'redux-promise'
import thunk from 'redux-thunk'

const config = {
  simple: 300
}

const debouncer = createDebounce(config)
const logger = createLogger()
const createMiddleware = applyMiddleware(thunk, debouncer, promise, logger)
const store = createMiddleware(createStore)(reducer)

const debounceAction = () => ({
  meta: {
    debounce: 'simple',
  },
  type: 'TEST',
})

Debounce middleware should be placed near the top of the chain.

Example

See the example directory.

$ cd example
$ npm install
$ npm start

API

redux-debounce exposes single constructor function for creating debounce middleware.

createDebounce( options: Object )

Options

Each option is a property to setup different debounces for different actions.

Number

Number of milliseconds to debounce the action for.

Object

wait (Number)

Number of milliseconds to debounce the action for.

maxWait (Number)

Maximum number of milliseconds before the action is called.

See lodash for the rest of the supported options.

License

Copyright © 2015-2016 Neil Kistner

Released under the MIT license. See license for details.

About

FSA-compliant middleware for Redux to debounce actions.

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •