Back to Content

ReportingObserver: observe() method

files/en-us/web/api/reportingobserver/observe/index.md

latest705 B
Original Source

{{APIRef("Reporting API")}}{{AvailableInWorkers}}

The observe() method of the {{domxref("ReportingObserver")}} interface instructs a reporting observer to start collecting reports in its report queue.

Syntax

js-nolint
observe()

Parameters

None.

Return value

None ({{jsxref("undefined")}}).

Examples

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

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

observer.observe();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also