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
は読み取り専用プロパティで、そのシグナルがやりとりしている非同期操作が中止されているか (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.