AbortSignal.aborted
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.
aborted
是一个只读属性,它返回一个 Boolean
表示与之通信的请求是否被终止(true
)或未终止(false
)
值
true
(中止)或 false
示例
在下面的代码段中,我们创建了一个新的 AbortController
对象,并获取它的 AbortSignal
(位于 signal
属性中)。然后我们用 aborted
属性检查这个信号是否已被中止,并把相应的日志发送给控制台。
js
const controller = new AbortController();
const signal = controller.signal;
// …
if (signal.aborted) {
console.log("Request has been aborted");
} else {
console.log("Request not aborted");
}
规格
Specification |
---|
DOM # ref-for-dom-abortsignal-aborted① |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aborted |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.