Skip to main content
setTimeout - timers/promises - Node documentation
function setTimeout

Usage in Deno

import { setTimeout } from "node:timers/promises";
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'

Type Parameters

T = void

Parameters

optional
delay: number = 1

The number of milliseconds to wait before fulfilling the promise.

optional
value: T

A value with which the promise is fulfilled.

optional
options: TimerOptions

Return Type

Promise<T>