PerformanceEventTiming: cancelable プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

読み取り専用の cancelable プロパティは、関連付けられたイベントの cancelable プロパティを返し、イベントを取り消すことができるかどうかを示します。

論理値です。関連付けられたイベントが取り消し可能であれば true、そうでなければ false です。

取り消し不可のイベントを監視

cancelable` プロパティは、イベントタイミング項目 (PerformanceEventTiming) を監視するときに使用することができます。例えば、取り消される可能性のないイベントのみをログ出力して測定する場合などです。

js
const observer = new PerformanceObserver((list) => {
  list.getEntries().forEach((entry) => {
    if (!entry.cancelable) {
      const delay = entry.processingStart - entry.startTime;
      console.log(entry.name, delay);
    }
  });
});

// イベントのオブザーバーを登録
observer.observe({ type: "event", buffered: true });

仕様書

Specification
Event Timing API
# dom-performanceeventtiming-cancelable

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
cancelable

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support