When called, requests that the Node.js event loop not exit so long as theTimeout
is active. Calling timeout.ref()
multiple times will have no effect.
By default, all Timeout
objects are "ref'ed", making it normally unnecessary
to call timeout.ref()
unless timeout.unref()
had been called previously.
a reference to timeout
v0.9.1
Sets the timer's start time to the current time, and reschedules the timer to call its callback at the previously specified duration adjusted to the current time. This is useful for refreshing a timer without allocating a new JavaScript object.
Using this on a timer that has already called its callback will reactivate the timer.
a reference to timeout
v10.2.0
When called, the active Timeout
object will not require the Node.js event loop
to remain active. If there is no other activity keeping the event loop running,
the process may exit before the Timeout
object's callback is invoked. Callingtimeout.unref()
multiple times will have no effect.
a reference to timeout
v0.9.1
Generated using TypeDoc
This object is created internally and is returned from
setTimeout()
andsetInterval()
. It can be passed to eitherclearTimeout()
orclearInterval()
in order to cancel the scheduled actions.By default, when a timer is scheduled using either
setTimeout()
orsetInterval()
, the Node.js event loop will continue running as long as the timer is active. Each of theTimeout
objects returned by these functions export bothtimeout.ref()
andtimeout.unref()
functions that can be used to control this default behavior.