Skip to main content
Module

x/fun/mod.ts>promise.wait

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function promise.wait
import { promise } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { wait } = promise;

Create a Promise that resolve after ms milliseconds.

Examples

Example 1

import { wait, map } from "./promise.ts";
import { pipe } from "./fn.ts";

const delayed = pipe(
  wait(1000),
  map(() => "Hello World"),
);

// After 1 second
const result = await delayed; // "Hello World"

Parameters

ms: number

Returns

Promise<void>