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/async_iterable.ts";

Add a delay between each value in an AsyncIterable.

@example
import { delay } from "./async_iterable.ts";
import { fromIterable } from "./async_iterable.ts";
import { pipe } from "./fn.ts";

const numbers = fromIterable([1, 2, 3]);
const delayed = pipe(
  numbers,
  delay(1000) // 1 second delay between each value
);

for await (const value of delayed) {
  console.log(value); // 1 (after 1s), 2 (after 2s), 3 (after 3s)
}
function delay(ms: number): <A>(ta: AsyncIterable<A>) => AsyncIterable<A>;
§
delay(ms: number): <A>(ta: AsyncIterable<A>) => AsyncIterable<A>
[src]

§Parameters

§
ms: number
[src]

§Return Type

§
<A>(ta: AsyncIterable<A>) => AsyncIterable<A>
[src]