Package Exports
- debounceify
- debounceify/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (debounceify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
debounceify
Tiny async debouncer
npm install debounceifyUsage
const debounceify = require('debounceify')
const debounced = debounceify(async function () {
console.log('Running...')
await new Promise(resolve => setTimeout(1000, resolve))
})
const a = debounced() // triggers the about function
const b = debounced()
const c = debounced()
const d = debounced() // these last 3 wait for the first one to finish
// then trigger one more.
await a
await b
await c
await dAPI
fn = debounceify(asyncFunction)
Debounces the asyncFunction so that
- No parallel executions of
asyncFunctionwill happen - Debounces the stack, so if 10 calls happen while
asyncFunctionis running only one more will be triggered when it finishes. - Forwards errors and return values.
debounceify.running
The active running job, null if none.
License
MIT