PerformanceObserver: disconnect() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
Note: This feature is available in Web Workers.
The disconnect()
method of the PerformanceObserver
interface is used to stop the performance observer from receiving any performance entry events.
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
Specification |
---|
Performance Timeline # dom-performanceobserver-disconnect |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
disconnect |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.