Web APIs

AbortController.abort()

Try the free JavaScript compiler

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

NameTypeDescription
reasonanyCancellation 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);
JavaScript Reference