← Back to index
interface AbortSignal
extends EventTarget

A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.

Properties

🔗
aborted: boolean

Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.

🔗
reason: any
🔗
onabort: ((this: AbortSignal, ev: Event) => any) | null

Methods

🔗
addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void
🔗
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void
🔗
removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void
🔗
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void
🔗
throwIfAborted(): void

Throws this AbortSignal's abort reason, if its AbortController has signaled to abort; otherwise, does nothing.