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 interface is exposed to Window and Worker.
Constructor
PerformanceObserver()- Creates a
PerformanceObserverobject.
Methods
PerformanceObserver.observe()- Specifies the set of
entry typesto observe. The performance observer's callback function will be invoked when aperformance entryis 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 entriesstored in the performance observer, emptying it out.
Example
function perf_observer(list, observer) {
// Process the "measure" event
}
var observer2 = new PerformanceObserver(perf_observer);
observer2.observe({entryTypes: ["measure"]});
Specifications
| Specification | Status | Comment |
|---|---|---|
| Performance Timeline Level 2 The definition of 'PerformanceObserver' in that specification. |
Candidate Recommendation | Initial definition of PerformanceObserver interface. |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | 52 | 57 (57) | No support | 39 | 11 |
| Available on workers | 62 | ? | ? | 49 | ? |
| Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | No support | 52 | 57.0 (57) | No support |
39 |
No support |
| Available on workers | No support | 62 | ? | ? |
49 |
? |

