Create a resettable watchdog timer for the current context, that will
asyncThrow if it ever times out.
So e.g. const deadline = watchdog(); deadline(5000, "Time's up!"); will set
up a 5 second timeout (with the error message "Time's up"), and you can then
call deadline() as many times as you like to start or reset the timer.
Returns (ms:number,message?:string)=>void
A function you can call zero or more times with a number of
milliseconds to reset the timer to. Passing zero cancels the timeout, and a
non-zero value starts it over with the new duration.
Create a resettable watchdog timer for the current context, that will asyncThrow if it ever times out.
So e.g.
const deadline = watchdog(); deadline(5000, "Time's up!");will set up a 5 second timeout (with the error message "Time's up"), and you can then calldeadline()as many times as you like to start or reset the timer.