Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno_nest/tests/mod.ts>delay

Refer to nestjs to realize some common functions for Deno, support hono and oak
Go to Latest
function delay
Re-export
import { delay } from "https://deno.land/x/deno_nest@v3.6.2/tests/mod.ts";

Resolve a Promise after a given amount of milliseconds.

Examples

Example 1

import { delay } from "https://deno.land/std@0.224.0/async/delay.ts";

// ...
const delayedPromise = delay(100);
const result = await delayedPromise;
// ...

To allow the process to continue to run as long as the timer exists. Requires --unstable flag.

import { delay } from "https://deno.land/std@0.224.0/async/delay.ts";

// ...
await delay(100, { persistent: false });
// ...

Parameters

ms: number
optional
options: DelayOptions = [UNSUPPORTED]

Returns

Promise<void>