Schedule a callback to trigger between min and max delay.
asyncCallback(doCallback) // invokes in 20-80ms const cancelFn = asyncCallback(doCallback, 0, 1000) // invokes in 0-1000ms cancelFn() // cancels timer (cleanup)
function to invoke after delay
minimum delay in milliseconds, defaults to 20
maximum delay in milliseconds, defaults to minDelay + 80
cancel / cleanup function to abort callback
Schedule a callback to trigger between min and max delay.
Examples