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

x/capi/deps/std/async.ts

[WIP] A framework for crafting interactions with Substrate chains
Latest
import * as capi from "https://deno.land/x/capi@v0.1.1-beta.1/deps/std/async.ts";

Provide help with asynchronous tasks like delays, debouncing, deferring, or pooling.

Classes

The MuxAsyncIterator class multiplexes multiple async iterators into a single stream. It currently makes an assumption that the final result (the value returned and not yielded from the iterator) does not matter; if there is any result, it is discarded.

Functions

Make Promise abortable with the given signal.

Make AsyncIterable abortable with the given signal.

Make Promise abortable with the given signal.

Create a promise which will be rejected with DeadlineError when a given delay is exceeded.

Creates a debounced function that delays the given func by a given wait time in milliseconds. If the method is called again before the timeout expires, the previous call will be aborted.

Creates a Promise with the reject and resolve functions placed as methods on the promise object itself.

Resolve a Promise after a given amount of milliseconds.

pooledMap transforms values from an (async) iterable into another async iterable. The transforms are done concurrently, with a max concurrency defined by the poolLimit.

Creates a retry promise which resolves to the value of the input using exponential backoff. If the input promise throws, it will be retried maxAttempts number of times. It will retry the input every certain amount of milliseconds, starting at minTimeout and multiplying by the multiplier until it reaches the maxTimeout

Branches the given async iterable into the n branches.

Interfaces

A debounced function that will be delayed by a given wait time in milliseconds. If the method is called again before the timeout expires, the previous call will be aborted.