ReportBody
Note: This feature is available in Web Workers.
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The ReportBody interface of the Reporting API represents the body of a report. Individual report types inherit from this interface, adding specific attributes relevant to the particular report.
The following interfaces inherit from ReportBody:
An instance of ReportBody is returned as the value of Report.body. The interface has no constructor.
Instance methods
ReportBody.toJSON()Deprecated-
A serializer which returns a JSON representation of the
ReportBodyobject.
Examples
In this example we create a new ReportingObserver to observe intervention reports. The InterventionReportBody interface inherits from ReportBody.
const options = {
types: ["intervention"],
buffered: true,
};
const observer = new ReportingObserver(([firstReport], observer) => {
console.log(firstReport.type); // intervention
}, options);
Specifications
| Specification |
|---|
| Reporting API> # reportbody> |