AbortController: abort() method
DOM
DOM
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
reason- : The reason why the operation was aborted, which can be any JavaScript value. If not specified, the reason is set to "AbortError" DOMException.
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.