This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AbortablePromise from './abortablePromise'; | |
export default function abortableFetch(input?: string | Request, init?: RequestInit) { | |
const signal = init ? init.signal : input ? input['signal'] : undefined; | |
const abortController = signal ? undefined : new AbortController(); | |
const promise = new AbortablePromise<Response>(fetch.apply(arguments), abortController); | |
if (signal) { | |
promise.signal = signal; |