web api instance method
AbortController: abort() method
Available in workers
The abort() method of the AbortController interface aborts an asynchronous operation before it has completed.
This is able to abort fetch requests, the consumption of any response bodies, or streams.
Syntax
abort()
abort(reason)
Parameters
reasonOptional- : The reason why the operation was aborted, which can be any JavaScript value.
If not specified, the reason is set to “AbortError”
DOMException.
- : The reason why the operation was aborted, which can be any JavaScript value.
If not specified, the reason is set to “AbortError”
Return value
None (undefined).
Examples
See the AbortSignal page for usage examples.
You can find a full working example on GitHub; you can also see it running live.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.