0.4.0 • Published 2 years ago

debounce-queue v0.4.0

Weekly downloads
490
License
-
Repository
github
Last release
2 years ago

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.