@esfx/cancelable-dom Package
The @esfx/cancelable-dom
package provides a DOM interop library for @esfx/cancelable.
Installation
npm i @esfx/cancelable-dom
Usage
import type { Cancelable } from "@esfx/cancelable";
import { toAbortSignal } from "@esfx/cancelable-dom";
async function doSomeWork(cancelable: Cancelable) {
await fetch("some/uri", { signal: toAbortSignal(cancelable) });
}
Functions
toAbortSignal(cancelable)
Declaration
export declare function toAbortSignal(cancelable: Cancelable): AbortSignal;
Parameters
- cancelable
- Cancelable
Returns
wrapAbortSignal(signal)
Declaration
export declare function wrapAbortSignal(signal: AbortController | AbortSignal): Cancelable;
Parameters
- signal
- AbortController | AbortSignal