PerformanceObserver
The PerformanceObserver
interface is used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline.
Note: This feature is available in Web Workers
Constructor
PerformanceObserver()
-
Creates and returns a new
PerformanceObserver
object.
Properties
-
PerformanceObserver.supportedEntryTypes
Read only -
Returns an array of the
entryType
values supported by the user agent.
Methods
PerformanceObserver.observe()
-
Specifies the set of
entry types
to observe. The performance observer's callback function will be invoked when aperformance entry
is recorded for one of the specifiedentryTypes
PerformanceObserver.disconnect()
-
Stops the performance observer callback from receiving
performance entries
. PerformanceObserver.takeRecords()
-
Returns the current list of
performance entries
stored in the performance observer, emptying it out.
Example
function observer_callback(list, observer) { // Process the "measure" event } let observer = new PerformanceObserver(observer_callback); observer.observe({entryTypes: ["measure"]});
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
PerformanceObserver |
52 |
79 |
57 |
No |
39 |
11 |
52 |
52 |
57 |
41 |
11 |
6.0 |
PerformanceObserver |
52 |
79 |
57 |
No |
39 |
11 |
52 |
52 |
57 |
41 |
11 |
6.0 |
disconnect |
52 |
79 |
57 |
No |
39 |
11 |
52 |
52 |
57 |
41 |
11 |
6.0 |
observe |
52 |
79 |
57 |
No |
39 |
11 |
52 |
52 |
57 |
41 |
11 |
6.0 |
supportedEntryTypes |
73 |
79 |
68 |
No |
Yes |
12.1 |
73 |
73 |
68 |
Yes |
12.2 |
11.0 |
takeRecords |
65 |
79 |
60 |
No |
Yes |
No |
65 |
65 |
60 |
Yes |
No |
9.0 |
worker_support |
62 |
≤79 |
57 |
No |
49 |
11 |
62 |
62 |
57 |
46 |
11 |
8.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver