debounce-by-key
useful for employing a group of functions within a single debounce scope and/or employing a single function across a group of debounce scopes
Installation
npm install debounce-by-key --save
Usage
This module provides a single function that takes a single options arg (optional) and returns a Promise
that resolves if the debounce state is non-blocking, and rejects if its blocking.
debounce([options])
- options
{Object}
- return:
Promise
[options]
key
the string identifier of the debounce scope. Defaults to''
duration
the time in milliseconds of the blocking state. Defaults to1000
Example
const debounce = const sayHi = {console} /* no-args */ //⛔ will not run /* multiple functions, single scope */ //⛔ will not run //⛔ will not run /* single function, mutliple scopes */ //✅ will run /* duration arg */const d = //⛔ will not run //✅ will run
Tests
npm installnpm test
Dependencies
None
Dev Dependencies
- tap: A Test-Anything-Protocol library
License
ISC