Firefox Tomorrow

web api instance method

ReportingObserver: disconnect() method

View on MDN ↗

Available in workers

The disconnect() method of the ReportingObserver interface stops a reporting observer that had previously started observing from collecting reports.

After calling disconnect(), neither takeRecords() nor the reports parameter of the ReportingObserver() callback will return any reports. The associated observer will no longer be active.

Syntax

disconnect()

Parameters

None.

Return value

None (undefined).

Examples

Basic usage

const options = {
  types: ["deprecation"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  reportBtn.onclick = () => displayReports(reports);
}, options);

observer.observe();

// …

observer.disconnect();

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also