Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Utilities for asynchronous operations, like delays, debouncing, or pooling
Classes
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.
Error thrown in retry once the maximum number of failed attempts
has been reached.
Functions
Resolves all values in a record of promises in parallel, returning a promise that resolves to a record with the same keys and resolved values.
Resolves all values in a record of promises in parallel, returning a promise
that resolves to a record with the same keys and PromiseSettledResult
objects as values.
Create a promise which will be rejected with DOMException 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.
Repeatedly calls a function until a condition is met, then returns the result.
pooledMap transforms values from an (async) iterable into another async iterable. The transforms are done concurrently, with a max concurrency defined by the poolLimit.
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.
Branches the given async iterable into the n branches.
Interfaces
A debounced function whose execution is delayed by a given wait
time in milliseconds. If the function is called again before
the timeout expires, the previous call will be aborted.
Options for delay.
- persistent: boolean
Indicates whether the process should continue to run as long as the timer exists.
- signal: AbortSignal
Signal used to abort the delay.
Options for poll.
Options for retry.
- isRetriable: (err: unknown) => boolean
Callback to determine if an error or other thrown value is retriable.
- jitter: number
Amount of jitter to introduce to the time between attempts. This is
1for full jitter by default. - maxAttempts: number
The maximum amount of attempts until failure.
- maxTimeout: number
The maximum milliseconds between attempts.
- minTimeout: number
The initial and minimum amount of milliseconds between attempts.
- multiplier: number
How much to backoff after each retry.
- signal: AbortSignal
An AbortSignal to cancel the retry operation.
Type Aliases
A record type where values can be promise-like (thenables) or plain values.
A record type where values are PromiseSettledResult objects.