Delays the invocation of a Callback function.
Call callback after 500ms
callback
const callback = (val) => console.log(val);delay(callback, 500, "val");// prints "val" after 500ms
Cancel delay
const callback = (val) => console.log(val);const cancelDelay = delay(callback, 500, "val");cancelDelay();// will not call the callback
the cancel Callback function
the Callback to call
the number of milliseconds to delay the function call
Rest
the arguments to pass to the callback function
arguments
Generated using TypeDoc
Delays the invocation of a Callback function.
Example
Call
callbackafter 500msExample
Cancel delay
Returns
the cancel Callback function