web-csv-toolbox
    Preparing search index...

    Interface AbortSignalOptions

    AbortSignal Options.

    interface AbortSignalOptions {
        signal?: AbortSignal;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    signal?: AbortSignal

    The signal to abort the operation.

    If the signal is aborted, the operation will be stopped.

    const controller = new AbortController();

    const csv = "foo,bar\n1,2\n3,4";
    try {
    const result = await parse(csv, { signal: controller.signal });
    } catch (e) {
    if (e instanceof DOMException && e.name === "AbortError") {
    console.log("Aborted");
    }
    }

    // Abort with user action
    document.getElementById("cancel-button")
    .addEventListener("click", () => {
    controller.abort();
    });
    const csv = "foo,bar\n1,2\n3,4";

    try {
    const result = await parse(csv, { signal: AbortSignal.timeout(1000) });
    } catch (e) {
    if (e instanceof DOMException && e.name === "TimeoutError") {
    console.log("Timeout");
    }
    }
    undefined