UNPKG

race-cancellation

Version:

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

11 lines 591 B
import { CancelExecutorFn, CancelReason, IsCancelledFn, RaceCancelFn } from "./interfaces.js"; /** * Create a {@link RaceCancelFn} function. * * @param isCancelled - a function that returns whether or not we are currently cancelled * @param executor - a callback to resolve the cancellation * @param cancelReason - an optional reason for the cancellation * @public */ export default function newRaceCancel(isCancelled: IsCancelledFn, executor: CancelExecutorFn, cancelReason?: (() => CancelReason | undefined) | CancelReason): RaceCancelFn; //# sourceMappingURL=newRaceCancel.d.ts.map