W3cubDocs

/DOM

PerformanceObserver.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 Time Level 2
The definition of 'disconnect()' in that specification.
Editor's Draft Initial definition of disconnect() method.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 52 57 (57) No support 39 No support
Available on workers 62 (Yes) (Yes) 49 (Yes)
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support No support 52 57.0 (57) No support

39

No support
Available on workers No support 62 (Yes) (Yes)

49

(Yes)

© 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/disconnect