Debounce that gives you an array of all previous events instead of just the last one.
npm install debounce-queue --save
import { watch } from 'fs'
import debounce from 'debounce-queue'
watch('.', debounce(list => {
for(const [eventType, filename] of list) {
...
}
}))
debounce(func, opts)
func
<function>(required)
The function to debounceopts
[number|object]
Options or waitopts.wait
[number=0]
The number of milliseconds to delayopts.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.