The PerformanceObserverEntryList
interface is a list of performance events that were explicitly observed via the observe()
method.
The PerformanceObserverEntryList
interface is a list of performance events that were explicitly observed via the observe()
method.
PerformanceObserverEntryList.getEntries()
Returns a list of all explicitly observed PerformanceEntry
objects.
PerformanceObserverEntryList.getEntriesByType()
Returns a list of all explicitly observed PerformanceEntry
objects of the given entry type.
PerformanceObserverEntryList.getEntriesByName()
Returns a list of all explicitly observed PerformanceEntry
objects based on the given name and entry type.
In the following example, list
is the PerformanceObserverEntryList
object. The getEntries()
method is called to get all explicitly observed PerformanceEntry
objects which are "measure" and "mark" in this case.
js
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"] });
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
PerformanceObserverEntryList |
52 | 79 | 57 | No | 39 | 11 | 52 | 52 | 57 | 41 | 11 | 6.0 |
getEntries |
52 | 79 | 57 | No | 39 | 11 | 52 | 52 | 57 | 41 | 11 | 6.0 |
getEntriesByName |
52 | 79 | 57 | No | 39 | 11 | 52 | 52 | 57 | 41 | 11 | 6.0 |
getEntriesByType |
52 | 79 | 57 | No | 39 | 11 | 52 | 52 | 57 | 41 | 11 | 6.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserverEntryList