The disconnect()
method of the PerformanceObserver
interface is used to stop the performance observer from receiving any performance entry events.
On this page
PerformanceObserver: disconnect() method
Syntax
js
disconnect()
Parameters
None.
Return value
None (undefined
).
Examples
Stopping a performance observer
The following example disconnects the performance observer to disable receiving any more performance entry events.
js
const observer = new PerformanceObserver((list, obj) => {
list.getEntries().forEach((entry) => {
// Process "measure" events
// …
// Disable additional performance events
observer.disconnect();
});
});
observer.observe({ entryTypes: ["mark", "measure"] });
Specifications
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–2023 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