Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

delay

import { delay } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/promise.ts";

Delay the resolution of an existing Promise. This does not affect the original promise directly, it only waits for a ms milliseconds before flatmaping into the original promise.

@example
import { wrap, delay } from "./promise.ts";
import { pipe } from "./fn.ts";

// Waits 250 milliseconds before returning
const result = await pipe(
  wrap(1),
  delay(250),
); // 1
function delay(ms: number): <A>(ua: Promise<A>) => Promise<A>;
§
delay(ms: number): <A>(ua: Promise<A>) => Promise<A>
[src]

§Parameters

§
ms: number
[src]

§Return Type

§
<A>(ua: Promise<A>) => Promise<A>
[src]