Debounce promise-returning & async functions.
import pDebounce = require('p-debounce');const expensiveCall = async input => input;const debouncedFn = pDebounce(expensiveCall, 200);for (const i of [1, 2, 3]) {debouncedFn(i).then(console.log);}//=> 3//=> 3//=> 3
A function that delays calling fn until after wait milliseconds have elapsed since the last time it was called.
fn
wait
Debounce promise-returning & async functions.