Skip to content

Debounce actions to ensure it will be processed only once.

License

Notifications You must be signed in to change notification settings

glena/actions-debouncer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions debouncer

This package attempts to debounce actions to ensure that only one will be excecuted in a defined timeout

Intallation

npm i actions-debouncer

Usage

const Debouncer = require('actions-debouncer')

const debouncer = new Debouncer( (value) => console.log(value) )

debouncer.do(1)
debouncer.do(2)
debouncer.do(3)

// Output: 3

Counstructor:

  • action: Closure. Receives the parameter sent to the do method
  • options: Object:
    • timeout: time in milisencods which it will debounce actions. Default 300ms.

About

Debounce actions to ensure it will be processed only once.

Resources

License

Stars

Watchers

Forks

Packages

No packages published