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 compatibility

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

Document Tags and Contributors

Last updated by: Sheppy,