The disconnect() method of the PerformanceObserver interface is used to stop the performance observer from receiving any performance entry events.
observer.disconnect();
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"]});
| Specification | Status | Comment |
|---|---|---|
| Performance Timeline Level 2 The definition of 'disconnect()' in that specification. | Candidate Recommendation | Initial definition of disconnect() method. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 52 | ? | 57 | No | 39 | 11 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | No | 52 | ? | 57 | 39 | 11 | ? |
© 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