Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 965 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 965 Bytes

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.