FsetTimeout
Bun

function

timers.promises.setTimeout

function setTimeout<T = void>(
delay?: number,
value?: T,
options?: TimerOptions
): Promise<T>;
import {
  setTimeout,
} from 'node:timers/promises';

const res = await setTimeout(100, 'result');

console.log(res);  // Prints 'result'
@param delay

The number of milliseconds to wait before fulfilling the promise. Default: 1.

@param value

A value with which the promise is fulfilled.

Referenced types

interface TimerOptions

  • ref?: boolean

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