Skip to main content
Module

x/effection/mod.ts>sleep

Structured concurrency and effects for JavaScript
Latest
function sleep
import { sleep } from "https://deno.land/x/effection@3.0.3/mod.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