Skip to content

Like lodash.debounce but you get an array of all previous (unique) events

License

Notifications You must be signed in to change notification settings

laggingreflex/debounce-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

debounce-queue

npm

Debounce that gives you an array of all previous events instead of just the last one.

Install

npm install debounce-queue --save

Usage

Example

import { watch } from 'fs'
import debounce from 'debounce-queue'

watch('.', debounce(list => {
  for(const [eventType, filename] of list) {
    ...
  }
}))

API

debounce(func, opts)
  • func <function>(required) The function to debounce
  • opts [number|object] Options or wait
  • opts.wait [number=0] The number of milliseconds to delay
  • opts.leading [boolean=false] Specify invoking on the leading edge of the timeout.
  • opts.maxWait [number] The maximum time func is allowed to be delayed before it's invoked.
  • opts.trailing [boolean=true] Specify invoking on the trailing edge of the timeout.

About

Like lodash.debounce but you get an array of all previous (unique) events

Resources

License

Stars

Watchers

Forks

Packages

No packages published