UNPKG

race-cancellation

Version:

Utilities for using Promise.race([task, cancellation]) for async/await code.

11 lines 678 B
import { CancellableAsyncFn, RaceCancelFn } from "./interfaces.js"; /** * Wrap a {@link CancellableAsyncFn} function to cancel still pending concurrent child {@link CancellableAsyncFn} * functions when another concurrent promise either rejected in a Promise.all() or won in a Promise.race(). * * @param cancellableAsync - a {@link CancellableAsyncFn} function to run with cancel pending * @param outerRaceCancel - an optional outer {@link RaceCancelFn} function * @public */ export default function withCancelPending<TResult>(cancellableAsync: CancellableAsyncFn<TResult>, outerRaceCancel?: RaceCancelFn): Promise<TResult>; //# sourceMappingURL=withCancelPending.d.ts.map