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 は読み取り専用プロパティで、そのシグナルが通信している DOM リクエストが中止されているか (true)、されていないか (false) を示す値を返します。

true (中止)または false

以下のスニペットでは、新しい AbortController オブジェクトを作成し、その AbortSignalsignal プロパティを使用して利用できます)を取得します。 その後、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 Standard
# ref-for-dom-abortsignal-aborted①

ブラウザーの互換性

BCD tables only load in the browser

関連情報