stack

Home > @infiniteobjects/core-library > Async

Async class

Utilities for parallel asynchronous operations, for use with the system Promise APIs.

Signature:

export declare class Async 

Properties

Property Modifiers Type Description
MapParallel static AsyncMapOptions Perform the operation in parallel with a concurrency of 10, and do not stop on error
MapSeries static AsyncMapOptions Perform the operation in series, and do not stop on error
MapSkipSymbol static symbol Return this value from a mapper function to skip including the value in the returned array.
pipe static typeof pPipe Compose promise-returning & async functions into a reusable pipeline

Methods

Method Modifiers Description
if(condition, doIf, doElse) static Conditional promise chains. It’s just a passthrough if condition is false and doElse is not provided.
map(iterable, mapper, options) static Map over promises concurrently
sleep(ms) static Return a promise that resolves after the specified number of milliseconds.
tap(tapHandler) static Tap into a promise chain without affecting its value or state. Use this in a .then() method.
tapCatch(tapHandler) static Tap into a promise chain without affecting its value or state. Use this in a .catch() method.