Home > @rushstack/node-core-library > Async
Async class
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Utilities for parallel asynchronous operations, for use with the system Promise
APIs.
Signature:
export declare class Async
Methods
Method | Modifiers | Description |
---|---|---|
forEachAsync(iterable, callback, options) | static | (BETA) Given an input array and a callback function, invoke the callback to start a promise for each element in the array. |
mapAsync(iterable, callback, options) | static | (BETA) Given an input array and a callback function, invoke the callback to start a promise for each element in the array. Returns an array containing the results. |
runWithRetriesAsync({ action, maxRetries, retryDelayMs }) | static | (BETA) Executes an async function and optionally retries it if it fails. |
sleep(ms) | static | (BETA) Return a promise that resolves after the specified number of milliseconds. |