{ "source": "doc/api/timers.md", "modules": [ { "textRaw": "Timers", "name": "timers", "stability": 3, "stabilityText": "Locked", "desc": "

All of the timer functions are globals. You do not need to require()\nthis module in order to use them.

\n", "methods": [ { "textRaw": "clearImmediate(immediateObject)", "type": "method", "name": "clearImmediate", "meta": { "added": [ "v0.9.1" ] }, "desc": "

Stops an immediateObject, as created by setImmediate, from triggering.

\n", "signatures": [ { "params": [ { "name": "immediateObject" } ] } ] }, { "textRaw": "clearInterval(intervalObject)", "type": "method", "name": "clearInterval", "meta": { "added": [ "v0.0.1" ] }, "desc": "

Stops an intervalObject, as created by setInterval, from triggering.

\n", "signatures": [ { "params": [ { "name": "intervalObject" } ] } ] }, { "textRaw": "clearTimeout(timeoutObject)", "type": "method", "name": "clearTimeout", "meta": { "added": [ "v0.0.1" ] }, "desc": "

Prevents a timeoutObject, as created by setTimeout, from triggering.

\n", "signatures": [ { "params": [ { "name": "timeoutObject" } ] } ] }, { "textRaw": "ref()", "type": "method", "name": "ref", "meta": { "added": [ "v0.9.1" ] }, "desc": "

If a timer was previously unref()d, then ref() can be called to explicitly\nrequest the timer hold the program open. If the timer is already refd calling\nref again will have no effect.

\n

Returns the timer.

\n", "signatures": [ { "params": [] } ] }, { "textRaw": "setImmediate(callback[, arg][, ...])", "type": "method", "name": "setImmediate", "meta": { "added": [ "v0.9.1" ] }, "desc": "

Schedules "immediate" execution of callback after I/O events'\ncallbacks and before timers set by setTimeout and setInterval are\ntriggered. Returns an immediateObject for possible use with\nclearImmediate. Additional optional arguments may be passed to the\ncallback.

\n

Callbacks for immediates are queued in the order in which they were created.\nThe entire callback queue is processed every event loop iteration. If an\nimmediate is queued from inside an executing callback, that immediate won't fire\nuntil the next event loop iteration.

\n", "signatures": [ { "params": [ { "name": "callback" }, { "name": "arg", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "setInterval(callback, delay[, arg][, ...])", "type": "method", "name": "setInterval", "meta": { "added": [ "v0.0.1" ] }, "desc": "

Schedules repeated execution of callback every delay milliseconds.\nReturns a intervalObject for possible use with clearInterval. Additional\noptional arguments may be passed to the callback.

\n

To follow browser behavior, when using delays larger than 2147483647\nmilliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the\ndelay.

\n", "signatures": [ { "params": [ { "name": "callback" }, { "name": "delay" }, { "name": "arg", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "setTimeout(callback, delay[, arg][, ...])", "type": "method", "name": "setTimeout", "meta": { "added": [ "v0.0.1" ] }, "desc": "

Schedules execution of a one-time callback after delay milliseconds.\nReturns a timeoutObject for possible use with clearTimeout. Additional\noptional arguments may be passed to the callback.

\n

The callback will likely not be invoked in precisely delay milliseconds.\nNode.js makes no guarantees about the exact timing of when callbacks will fire,\nnor of their ordering. The callback will be called as close as possible to the\ntime specified.

\n

To follow browser behavior, when using delays larger than 2147483647\nmilliseconds (approximately 25 days) or less than 1, the timeout is executed\nimmediately, as if the delay was set to 1.

\n", "signatures": [ { "params": [ { "name": "callback" }, { "name": "delay" }, { "name": "arg", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "unref()", "type": "method", "name": "unref", "meta": { "added": [ "v0.9.1" ] }, "desc": "

The opaque value returned by setTimeout and setInterval also has the\nmethod timer.unref() which allows the creation of a timer that is active but\nif it is the only item left in the event loop, it won't keep the program\nrunning. If the timer is already unrefd calling unref again will have no\neffect.

\n

In the case of setTimeout, unref creates a separate timer that will\nwakeup the event loop, creating too many of these may adversely effect event\nloop performance -- use wisely.

\n

Returns the timer.

\n", "signatures": [ { "params": [] } ] } ], "type": "module", "displayName": "Timers" } ] }