AbortSignal.abort() is a static method that allows creating a new AbortSignal object that is already aborted. It is similar in spirit to Promise.reject(), and provides improved developer ergonomics.

Motivation

Web developers have found aborted AbortSignal objects to be useful for a variety of purposes. It signifies to JavaScript APIs that no work should be done. However currently, creating an already-aborted AbortSignal object requires jumping through quite a few hoops: const controller = new AbortController(); controller.abort(); return controller.signal; A new AbortSignal.abort() factory function simplifies this to just return AbortSignal.abort();

Specification

Specification link


Unknown standards status - check spec link for status

Status in Chromium

Blink>DOM


Enabled by default (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owner

Intent to Prototype url

Intent to Prototype thread

Search tags

AbortSignal,

Last updated on 2021-09-16