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 | Status | Comment |
---|---|---|
Performance Timeline Level 2 The definition of 'disconnect()' in that specification. |
Candidate Recommendation | Initial definition of disconnect() method. |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
disconnect | Chrome Full support 52 | Edge Full support ≤79 | Firefox Full support 57 | IE No support No | Opera Full support 39 | Safari Full support 11 | WebView Android Full support 52 | Chrome Android Full support 52 | Firefox Android Full support 57 | Opera Android Full support 41 | Safari iOS Full support 11 | Samsung Internet Android Full support 6.0 |
Legend
- Full support
- Full support
- No support
- No support