Function makeAbortable

  • Creates and handles an AbortSignal**

    const [signal, abort, filterAbortError] =  makeAbortable({ timeout: 10000 });
    const fetcher = (url) => fetch(url, {signal:signal()}).catch(filterAbortError); // filters abort errors

    Returns an accessor for the signal and the abort callback.

    Options are optional and include:

    • timeout: time in Milliseconds after which the fetcher aborts automatically
    • noAutoAbort: can be set to true to make a new source not automatically abort a previous request

    Parameters

    • options: any

    Returns ((reason: any) => void)[]