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 interface is exposed to Window and Worker.

Constructor

PerformanceObserver()
Creates a 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 compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support52 ?57 No3911
Available in workers62 ? ? No49 ?
PerformanceObserver() constructor52 ?57 No39 No
disconnect52 ?57 No39 No
observe52 ?57 No39 No
takeRecords Yes ?60 No Yes No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No52 ?5739 No ?
Available in workers6262 ? ?49 ? ?
PerformanceObserver() constructor No52 ?5739 No ?
disconnect No52 ?5739 No ?
observe No52 ?5739 No ?
takeRecords No Yes ?60 Yes No ?

Document Tags and Contributors

Last updated by: fscholz,