web api interface
EventCounts
The EventCounts interface of the Performance API provides the number of events that have been dispatched for each event type.
An EventCounts instance is a read-only Map-like object, in which each key is the name string for an event type, and the corresponding value is an integer indicating the number of events that have been dispatched for that event type.
Constructor
This interface has no constructor. You typically get an instance of this object using the eventCounts property.
Instance properties
size- : See
sizefor details.
- : See
Instance methods
entries()- : See
entries()for details.
- : See
forEach()- : See
forEach()for details.
- : See
get()- : See
get()for details.
- : See
has()- : See
has()for details.
- : See
keys()- : See
keys()for details.
- : See
values()- : See
values()for details.
- : See
Examples
Working with EventCount maps
Below are a few examples to get information from an EventCounts map. Note that the map is read-only and the clear(), delete(), and set() methods aren’t available.
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()];
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.