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

x/effection/lib/sleep.ts>sleep

Structured concurrency and effects for JavaScript
Latest
function sleep
import { sleep } from "https://deno.land/x/effection@4.0.0-alpha.1/lib/sleep.ts";

Sleep for the given amount of milliseconds.

Examples

Example 1

import { main, sleep } from 'effection';

await main(function*() {
  yield* sleep(2000);
  console.log("Hello lazy world!");
});

Parameters

duration: number
  • the number of milliseconds to sleep