AbortController: abort() method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("DOM")}}{{AvailableInWorkers}}
The **abort()** method of the {{domxref("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
js-nolint
abort()
abort(reason)Parameters
reason{{optional_inline}}- : The reason why the operation was aborted, which can be any JavaScript value.
If not specified, the reason is set to "AbortError" {{domxref("DOMException")}}.
Return value
None ({{jsxref("undefined")}}).
Examples
See the [AbortSignal page](/en-US/docs/Web/API/AbortSignal#examples) for usage examples.
You can find a full working example on GitHub; you can also see it running live.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}