The @esfx/cancelable-dom
package provides a DOM interop library for @esfx/cancelable
.
npm i @esfx/cancelable-dom
import { Cancelable } from "@esfx/cancelable";
import { toAbortSignal } from "@esfx/cancelable-dom";
async function doSomeWork(cancelable: Cancelable) {
await fetch("some/uri", { signal: toAbortSignal(cancelable) });
}
You can read more about the API here.