Function delay

  • import {
    setTimeout,
    } from 'timers/promises';

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

    console.log(res); // Prints 'result'

    Since

    v15.0.0

    Type Parameters

    • T = void

    Parameters

    • Optional delay: number

      The number of milliseconds to wait before fulfilling the promise.

    • Optional value: T

      A value with which the promise is fulfilled.

    • Optional options: TimerOptions

    Returns Promise<T>

Generated using TypeDoc