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.
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 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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
PerformanceObserver | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 57 | Opera Android Full support 41 | Safari iOS Full support 11 | Samsung Internet Android Full support 6.0 |
PerformanceObserver() constructor | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 57 | Opera Android Full support 41 | Safari iOS Full support 11 | Samsung Internet Android Full support 6.0 |
disconnect | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 57 | Opera Android Full support 41 | Safari iOS Full support 11 | Samsung Internet Android Full support 6.0 |
observe | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 57 | Opera Android Full support 41 | Safari iOS Full support 11 | Samsung Internet Android Full support 6.0 |
supportedEntryTypes | Chrome Full support 73 | Edge Full support ≤79 | Firefox ? | IE No support No | Opera Full support Yes | Safari Full support 12.1 | WebView Android Full support 73 | Chrome Android Full support 73 | Firefox Android ? | Opera Android Full support Yes | Safari iOS Full support 12.2 | Samsung Internet Android Full support 11.0 |
takeRecords | Chrome Full support 65 | Edge Full support ≤79 | Firefox Full support 60 | IE No support No | Opera Full support Yes | Safari No support No | WebView Android Full support 65 | Chrome Android Full support 65 | Firefox Android Full support 60 | Opera Android Full support Yes | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
Available in workers | Chrome Full support 62 | Edge Full support ≤79 | Firefox ? | IE No support No | Opera Full support 49 | Safari ? | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android Full support 46 | Safari iOS ? | Samsung Internet Android Full support 8.0 |
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.