Die EventCounts-Schnittstelle der Performance API liefert die Anzahl der Ereignisse, die für jeden Ereignistyp ausgelöst wurden.
Eine EventCounts-Instanz ist ein schreibgeschütztes Map-ähnliches Objekt, bei dem jeder Schlüssel eine Zeichenkette für einen Ereignistyp ist und der entsprechende Wert eine ganze Zahl, die die Anzahl der ausgelösten Ereignisse für diesen Ereignistyp angibt.
Im Folgenden finden Sie einige Beispiele, um Informationen aus einem EventCounts-Map zu erhalten. Beachten Sie, dass das Map schreibgeschützt ist und die Methoden clear(), delete() und set() nicht verfügbar sind.
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()];
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No 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.