PeformanceObserver.disconnect()

The disconnect() method of the PerformanceObserver interface is used to stop the performance observer from receiving any performance entry events.

Syntax

observer.disconnect();

Example

var observer = new PerformanceObserver(function(list, obj) {
  var entries = list.getEntries();
  for (var i=0; i < entries.length; i++) {
    // Process "mark" and "frame" events
  }
});
observer.observe({entryTypes: ["mark", "frame"]});

function perf_observer(list, observer) {
  // Process the "measure" event 
  // ...
  // Disable additional performance events
  observer.disconnect();
}
var observer2 = new PerformanceObserver(perf_observer);
observer2.observe({entryTypes: ["measure"]});

Specifications

Specification Status Comment
Performance Timeline Level 2
The definition of 'disconnect()' in that specification.
Candidate Recommendation Initial definition of disconnect() method.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support52 ?57 No39 No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No52 ?5739 No ?

Document Tags and Contributors

Contributors to this page: fscholz, jpmedley, chrisdavidmills, teoli, rolfedh, AFBarstow
Last updated by: fscholz,