UNPKG

race-cancellation

Version:

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

15 lines 577 B
/** * A no-op implemenation of a {@link RaceCancelFn} function. * * @remarks * Allows an async function to add cancellation support in a backwards compatible way by * adding optional param by providing this as a default. * * @param asyncFnOrPromise - an {@link AsyncFn} or `PromiseLike` that will be resolved. * @public */ const noopRaceCancel = (asyncFnOrPromise) => typeof asyncFnOrPromise === "function" ? Promise.resolve().then(asyncFnOrPromise) : Promise.resolve(asyncFnOrPromise); export default noopRaceCancel; //# sourceMappingURL=noopRaceCancel.js.map