UNPKG

race-cancellation

Version:

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

14 lines 617 B
import { RaceCancelFn, ResolveCancelFn } from "./interfaces.js"; /** * Create a tuple of {@link RaceCancelFn} and {@link ResolveCancelFn} functions. * * @remarks * In general, it is better to use {@link race-cancellation#withCancel} to scope cancellation * to an async task so that the cancellation concern is cleaned up. * * If the cancellation concern will be GC'ed with the cancel already and no cleanup * needed like removing an event listener than this method can be simpler. * @public */ export default function deferCancel(): [RaceCancelFn, ResolveCancelFn]; //# sourceMappingURL=deferCancel.d.ts.map