class AbortSignal
Signals abortion to abortable operations such as fetch().
Index
Properties
Methods
aborted boolean read-only
Whether the signal has been aborted.
addEventListener(type, listener)
Registers a listener.
addEventListener(type: string, listener: (...args: any[]) => void): void;
| Name | Type | Description |
|---|---|---|
| type | string | the event name, typically "abort" |
| listener | (...args: any[]) => void | the callback to invoke |
reason any read-only
The abort reason, when AbortSignal.aborted is true.
removeEventListener(type, listener)
Removes a previously registered listener.
removeEventListener(type: string, listener: (...args: any[]) => void): void;
| Name | Type | Description |
|---|---|---|
| type | string | the event name |
| listener | (...args: any[]) => void | the callback to remove |
AbortSignal.timeout(ms) static
Returns a signal that aborts automatically after ms milliseconds.
static timeout(ms: number): AbortSignal;
| Name | Type | Description |
|---|---|---|
| ms | number | the timeout in milliseconds |
| Return Value | AbortSignal |