Skip to main content
Home
This release is 1 version behind 1.0.16 — the latest version of @std/async. Jump to latest

Utilities for asynchronous operations, like delays, debouncing, or pooling

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 months ago (1.0.15)

default

Provide helpers with asynchronous tasks like delays, debouncing, retrying, or pooling.

f
abortable

Make a Promise abortable with the given signal.

f
deadline

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

I
DeadlineOptions

Options for deadline.

f
debounce

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.

I
DebouncedFunction

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.

f
delay

Resolve a Promise after a given amount of milliseconds.

I
DelayOptions

Options for delay.

c
MuxAsyncIterator

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.

f
pooledMap

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

f
retry

Calls the given (possibly asynchronous) function up to maxAttempts times. Retries as long as the given function throws. If the attempts are exhausted, throws a RetryError with cause set to the inner exception.

c
RetryError

Error thrown in retry once the maximum number of failed attempts has been reached.

f
tee

Branches the given async iterable into the n branches.

f
abortable

Make a Promise abortable with the given signal.

f
deadline

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

I
DeadlineOptions

Options for deadline.

f
debounce

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.

I
DebouncedFunction

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.

f
delay

Resolve a Promise after a given amount of milliseconds.

I
DelayOptions

Options for delay.

c
MuxAsyncIterator

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.

f
pooledMap

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

f
retry

Calls the given (possibly asynchronous) function up to maxAttempts times. Retries as long as the given function throws. If the attempts are exhausted, throws a RetryError with cause set to the inner exception.

c
RetryError

Error thrown in retry once the maximum number of failed attempts has been reached.

I
RetryOptions

Options for retry.