Skip to main content

delay

Callable

  • delay(milliseconds: number, options?: TimerOptions): Promise<void>

  • Resolves a promise after waiting milliseconds

    @example
    await delay(5);// Will wait 5 milliseconds

    const controller = new AbortController();
    setTimeout(() => controller.abort(new Error('CustomError')));
    await delay(5, { signal: controller.signal });// Will reject with Error('CustomError')