Mtimers
Bun

Node.js module

timers

The 'node:timers' module provides timer functions like setTimeout, setInterval, setImmediate, and their clear counterparts. These functions schedule callbacks for future execution in the event loop.

The module also includes utility methods to measure and manage timers programmatically.

Works in Bun

Module is implemented, but it's recommended to use global setTimeout, setInterval, setImmediate, etc. instead.

Type definitions

  • interface TimerOptions

    • ref?: boolean

      Set to false to indicate that the scheduled Timeout should not require the Node.js event loop to remain active.

    • signal?: AbortSignal

      When provided the corresponding AbortController can be used to cancel an asynchronous action.