Web APIs
AbortController.abort()
Signal cancellation to consumers that observe this controller. The optional reason is stored on the signal; cancellation does not forcibly stop arbitrary code. Example console output: true superseded.
Formal Syntax & Structure
javascript syntaxjavascript
controller.abort([reason])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| reason | any | Cancellation reason; defaults to an AbortError DOMException. |
Return Value
undefined
No result value.
Working Example
Example Snippetjavascript
const c=new AbortController(); c.abort("superseded"); console.log(c.signal.aborted,c.signal.reason);