Timers
timeout.refresh()
Restarts the timeout using the existing delay and handle. Useful for activity-based expiry timers without allocating a new timer each time. Refreshing a timer that has already fired can reactivate it; clear timers when ownership ends. Tested on Node.js 22.16.0. Example output (one line per entry): ["true 0"].
Formal Syntax & Structure
nodejs syntaxnodejs
timeout.refresh()Return Value
Timeout
The same timer object.
Working Example
Example Snippetnodejs
let calls = 0;const t = setTimeout(() => calls++, 1000);try { console.log(t.refresh() === t, calls);}finally { clearTimeout(t);}