AbortController

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2019⁩.

Note: This feature is available in Web Workers.

The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.

You can create a new AbortController object using the AbortSignal object.

Constructor

AbortController()

Creates a new AbortController object instance.

Instance properties

AbortController.signal Read only

Returns an AbortSignal object instance, which can be used to communicate with, or to abort, an asynchronous operation.

Instance methods

AbortController.abort()

Aborts an asynchronous operation before it has completed. This is able to abort fetch requests, consumption of any response bodies, and streams.

Examples

See the AbortSignal page for usage examples.

You can find a running live.

Specifications

Specification
DOM
# interface-abortcontroller

Browser compatibility

See also

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant