AbortSignal
interface
interface AbortSignal extends EventTargetA signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
variable
var AbortSignal: { … }The constructor object for AbortSignal.
AbortSignal instances are obtained from an AbortController or via the
static abort, timeout, and any factory methods rather than constructed
directly, so calling the constructor throws.
Constructors
constructor
new AbortSignal(): neverProperties
aborted
readonly aborted: booleanReturns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
reason
readonly reason: anyonabort
onabort: ((this: AbortSignal, ev: Event) => any) | nullprototype
readonly prototype: AbortSignalMethods
addEventListener
addEventListener<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): voidaddEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): voidremoveEventListener
removeEventListener<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): voidremoveEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): voidthrowIfAborted
throwIfAborted(): voidThrows this AbortSignal's abort reason, if its AbortController has signaled to abort; otherwise, does nothing.
abort
abort(reason?: any): AbortSignalany
any(signals: AbortSignal[]): AbortSignaltimeout
timeout(milliseconds: number): AbortSignal