Usage in Deno
import * as mod from "node:timers";
The timer module exposes a global API for scheduling functions to
be called at some future period of time. Because the timer functions are
globals, there is no need to import node:timers to use the API.
The timer functions within Node.js implement a similar API as the timers API provided by Web Browsers but use a different internal implementation that is built around the Node.js Event Loop.
Functions #
Returns an async iterator that generates values in an interval of delay ms.
If ref is true, you need to call next() of async iterator explicitly
or implicitly to keep the event loop alive.
The queueMicrotask() method queues a microtask to invoke callback. If
callback throws an exception, the process object 'uncaughtException'
event will be emitted.
Interfaces #
This object is created internally and is returned from setImmediate(). It
can be passed to clearImmediate() in order to cancel the scheduled
actions.
Namespaces #
The timers/promises API provides an alternative set of timer functions
that return Promise objects. The API is accessible via
require('node:timers/promises').