PeformanceObserver.disconnect()
The disconnect()
method of the PerformanceObserver
interface is used to stop the performance observer from receiving any performance entry events.
Syntax
performanceObserver.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 |
---|
Performance Timeline Level 2 (Performance Timeline 2) # dom-performanceobserver-disconnect |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
disconnect |
52 |
79 |
57 |
No |
39 |
11 |
52 |
52 |
57 |
41 |
11 |
6.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/disconnect