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

x/ayonli_jsext/promise/index.ts>sleep

A JavaScript extension package for building strong and modern applications.
Latest
function sleep
import { sleep } from "https://deno.land/x/ayonli_jsext@v0.9.72/promise/index.ts";

Blocks the context for a given duration.

Examples

Example 1

import { sleep } from "@ayonli/jsext/async";

console.log("Hello");

await sleep(1000);
console.log("World"); // "World" will be printed after 1 second

Parameters

ms: number

Returns

Promise<void>