EventCounts
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
EventCounts はパフォーマンス APIのインターフェイスで、それぞれのイベント型で配信されたイベントの数を提供します。
EventCounts インスタンスは読み取り専用の Map 風オブジェクトで、各キーはイベント型の名前の文字列で、対応する値はそのイベント型で配信されたイベントの数を示す整数です。
コンストラクター
このインターフェイスにはコンストラクターがありません。通常は performance.eventCounts プロパティを使用してこのオブジェクトのインスタンスを取得します。
インスタンスプロパティ
size-
詳しくは
Map.prototype.sizeを参照してください。
インスタンスメソッド
entries()-
詳しくは
Map.prototype.entries()を参照してください。 forEach()-
詳しくは
Map.prototype.forEach()を参照してください。 get()-
詳しくは
Map.prototype.get()を参照してください。 has()-
詳しくは
Map.prototype.has()を参照してください。 keys()-
詳しくは
Map.prototype.keys()を参照してください。 values()-
詳しくは
Map.prototype.values()を参照してください。
例
>EventCount マップの使用
以下は EventCounts マップから情報を取得するいくつかの例です。マップは読み取り専用のため、 clear(), delete(), set() メソッドは利用できないことに注意してください。
js
for (entry of performance.eventCounts.entries()) {
const type = entry[0];
const count = entry[1];
}
const clickCount = performance.eventCounts.get("click");
const isExposed = performance.eventCounts.has("mousemove");
const exposedEventsCount = performance.eventCounts.size;
const exposedEventsList = [...performance.eventCounts.keys()];
仕様書
| Specification |
|---|
| Event Timing API> # sec-event-counts> |
ブラウザーの互換性
Loading…