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
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 52 | Edge ? | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support Yes | Chrome Android Full support 52 | Edge Mobile ? | Firefox Android Full support 57 | Opera Android Full support 39 | Safari iOS Full support 11 | Samsung Internet Android ? |
| Available in workers | Chrome Full support 62 | Edge ? | Firefox ? | IE No support No | Opera Full support 49 | Safari ? | WebView Android Full support 62 | Chrome Android Full support 62 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 49 | Safari iOS ? | Samsung Internet Android ? |
PerformanceObserver() constructor | Chrome Full support 52 | Edge ? | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android No support No | Chrome Android Full support 52 | Edge Mobile ? | Firefox Android Full support 57 | Opera Android Full support 39 | Safari iOS Full support 11 | Samsung Internet Android ? |
disconnect | Chrome Full support 52 | Edge ? | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android No support No | Chrome Android Full support 52 | Edge Mobile ? | Firefox Android Full support 57 | Opera Android Full support 39 | Safari iOS Full support 11 | Samsung Internet Android ? |
observe | Chrome Full support 52 | Edge ? | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android No support No | Chrome Android Full support 52 | Edge Mobile ? | Firefox Android Full support 57 | Opera Android Full support 39 | Safari iOS Full support 11 | Samsung Internet Android ? |
takeRecords | Chrome Full support Yes | Edge ? | Firefox Full support 60 | IE No support No | Opera Full support Yes | Safari No support No | WebView Android No support No | Chrome Android Full support Yes | Edge Mobile ? | Firefox Android Full support 60 | Opera Android Full support Yes | Safari iOS No support No | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
Document Tags and Contributors
Tags:
Contributors to this page:
Sheppy,
fscholz,
chrisdavidmills,
jpmedley,
stefanjudis,
teoli,
rolfedh,
AFBarstow
Last updated by:
Sheppy,