Event timing
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.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 85 | 85 | 89 | 26.2 | 85 | 26.2 | |
@@iterator [Symbol.iterator] | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
entries | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
forEach | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
get | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
has | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
keys | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
size | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
values | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
| The read-only performance.eventCounts property is an EventCounts map containing the number of events which have been dispatched per event type since the page was loaded. | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
| The PerformanceEventTiming interface of the Event Timing API provides insights into the latency of certain event types triggered by user interaction. | 76 | 79 | 89 | 26.2 | 76 | 26.2 |
| The read-only cancelable property returns the associated event's cancelable property, indicating whether the event can be canceled. | 76 | 79 | 89 | 26.2 | 76 | 26.2 |
| The read-only interactionId property of the PerformanceEventTiming interface returns an ID that uniquely identifies a user interaction which triggered a series of associated events. | 96 | 96 | 144 | 26.2 | 96 | 26.2 |
| The read-only processingEnd property returns the time the last event handler finished executing. | 76 | 79 | 89 | 26.2 | 76 | 26.2 |
| The read-only processingStart property returns the time at which event dispatch started. This is when event handlers are about to be executed. | 76 | 79 | 89 | 26.2 | 76 | 26.2 |
| The read-only target property returns the associated event's last target which is the node onto which the event was last dispatched. | 85 | 85 | 89 | 26.2 | 85 | 26.2 |
| The toJSON() method of the PerformanceEventTiming interface is a Serialization; it returns a JSON representation of the PerformanceEventTiming object. | 76 | 79 | 89 | 26.2 | 76 | 26.2 |
Use cases
-
Using Event timing
The EventCounts interface of the Performance API provides the number of events that have been dispatched for each event type.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.