deno.com

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 #

f
clearImmediate

Cancels an Immediate object created by setImmediate().

    f
    clearInterval

    Cancels a Timeout object created by setInterval().

      f
      clearTimeout

      Cancels a Timeout object created by setTimeout().

        f
        promises.setImmediate
        No documentation available
          f
          promises.setInterval

          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.

            f
            promises.setTimeout
            No documentation available
              f
              queueMicrotask

              The queueMicrotask() method queues a microtask to invoke callback. If callback throws an exception, the process object 'uncaughtException' event will be emitted.

                f
                N
                setImmediate

                Schedules the "immediate" execution of the callback after I/O events' callbacks.

                  f
                  setImmediate.setImmediate
                  No documentation available
                    f
                    setInterval

                    Schedules repeated execution of callback every delay milliseconds.

                      f
                      N
                      setTimeout

                      Schedules execution of a one-time callback after delay milliseconds.

                        f
                        setTimeout.setTimeout
                        No documentation available

                          Interfaces #

                          I
                          Immediate

                          This object is created internally and is returned from setImmediate(). It can be passed to clearImmediate() in order to cancel the scheduled actions.

                          I
                          promises.Scheduler
                          No documentation available
                          I
                          Timeout

                          This object is created internally and is returned from setTimeout() and setInterval(). It can be passed to either clearTimeout() or clearInterval() in order to cancel the scheduled actions.

                          I
                          TimerOptions
                          No documentation available
                          I
                          Timer
                          No documentation available

                          Namespaces #

                          N
                          promises

                          The timers/promises API provides an alternative set of timer functions that return Promise objects. The API is accessible via require('node:timers/promises').

                            Variables #

                            v
                            promises.scheduler
                            No documentation available