PerformanceObserverEntryList
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available inWeb Workers.
ThePerformanceObserverEntryList interface is a list ofperformance events that were explicitly observed via theobserve() method.
In this article
Instance methods
PerformanceObserverEntryList.getEntries()Returns a list of all explicitly observed
PerformanceEntryobjects.PerformanceObserverEntryList.getEntriesByType()Returns a list of all explicitly observed
PerformanceEntryobjects of the given entry type.PerformanceObserverEntryList.getEntriesByName()Returns a list of all explicitly observed
PerformanceEntryobjects based on the given name and entry type.
Example
>Using PerformanceObserverEntryList
In the following example,list is thePerformanceObserverEntryList object. ThegetEntries() method is called to get all explicitly observedPerformanceEntry objects which are "measure" and "mark" in this case.
function perfObserver(list, observer) { list.getEntries().forEach((entry) => { if (entry.entryType === "mark") { console.log(`${entry.name}'s startTime: ${entry.startTime}`); } if (entry.entryType === "measure") { console.log(`${entry.name}'s duration: ${entry.duration}`); } });}const observer = new PerformanceObserver(perfObserver);observer.observe({ entryTypes: ["measure", "mark"] });Specifications
| Specification |
|---|
| Performance Timeline> # performanceobserverentrylist-interface> |