web api instance method
PerformanceObserver: disconnect() method
Available in workers
The disconnect() method of the PerformanceObserver interface is used to stop the performance observer from receiving any performance entry events.
Syntax
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.
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
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.