W3cubDocs

/DOM

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.

Methods

PerformanceObserver.observe()
Specifies the set of entry types to observe. The performance observer's callback function will be invoked when a performance entry is recorded for one of the specified entryTypes
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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 52 ? 57 No 39 11
Available in workers 62 ? ? No 49 ?
PerformanceObserver() constructor 52 ? 57 No 39 11
disconnect 52 ? 57 No 39 11
observe 52 ? 57 No 39 11
takeRecords Yes ? 60 No Yes No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes 52 ? 57 39 11 ?
Available in workers 62 62 ? ? 49 ? ?
PerformanceObserver() constructor No 52 ? 57 39 11 ?
disconnect No 52 ? 57 39 11 ?
observe No 52 ? 57 39 11 ?
takeRecords No Yes ? 60 Yes No ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver