@esfx/cancelable-dom Package

    The @esfx/cancelable-dom package provides a DOM interop library for @esfx/cancelable.

    Installation

    npm i @esfx/cancelable-dom
    

    Usage

    • TypeScript
    • JavaScript (CommonJS)
    import type { Cancelable } from "@esfx/cancelable";
    import { toAbortSignal } from "@esfx/cancelable-dom";
    
    async function doSomeWork(cancelable: Cancelable) {
        await fetch("some/uri", { signal: toAbortSignal(cancelable) });
    }
    
    const { toAbortSignal } = require("@esfx/cancelable-dom");
    
    async function doSomeWork(cancelable) {
        await fetch("some/uri", { signal: toAbortSignal(cancelable) });
    }
    

    Functions

    toAbortSignal(cancelable)

    Declaration
    export declare function toAbortSignal(cancelable: Cancelable): AbortSignal;
    Parameters
    cancelable
    Cancelable

    Returns
    AbortSignal

    wrapAbortSignal(signal)

    Declaration
    export declare function wrapAbortSignal(signal: AbortController | AbortSignal): Cancelable;
    Parameters
    signal
    AbortController | AbortSignal

    Returns
    Cancelable

    • Improve this Doc
    Generated by DocFX