Skip to content

articulate/dampen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dampen

npm version npm downloads Build Status Coverage Status

Debounce any redux action-creator.

const dampen = require('dampen')

const update = dampen(250, payload =>
  ({ type: 'UPDATE', payload })
)

// elsewhere...

dispatch(update('one'))
dispatch(update('two'))
dispatch(update('three'))

// only { type: 'UPDATE', payload: 'three' }
// will be dispatched after 250ms

Requires redux-thunk or native support for thunks to function properly.