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

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
PerformanceObserverChrome Full support 52Edge Full support ≤79Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 57Opera Android Full support 41Safari iOS Full support 11Samsung Internet Android Full support 6.0
PerformanceObserver() constructorChrome Full support 52Edge Full support ≤79Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 57Opera Android Full support 41Safari iOS Full support 11Samsung Internet Android Full support 6.0
disconnectChrome Full support 52Edge Full support ≤79Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 57Opera Android Full support 41Safari iOS Full support 11Samsung Internet Android Full support 6.0
observeChrome Full support 52Edge Full support ≤79Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 57Opera Android Full support 41Safari iOS Full support 11Samsung Internet Android Full support 6.0
supportedEntryTypes
Experimental
Chrome Full support 73Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari Full support 12.1WebView Android Full support 73Chrome Android Full support 73Firefox Android ? Opera Android Full support YesSafari iOS Full support 12.2Samsung Internet Android Full support 11.0
takeRecords
Experimental
Chrome Full support 65Edge Full support ≤79Firefox Full support 60IE No support NoOpera Full support YesSafari No support NoWebView Android Full support 65Chrome Android Full support 65Firefox Android Full support 60Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support 9.0
Available in workersChrome Full support 62Edge Full support ≤79Firefox ? IE No support NoOpera Full support 49Safari ? WebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android Full support 46Safari 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.

See also