Reporting API
The takeRecords() method of the ReportingObserver interface returns the current list of reports contained in the observer's report queue, and empties the queue.
Syntax
takeRecords()
Parameters
None.
Return value
An array of report objects, such as COEPViolationReport and IntegrityViolationReport.
The object dictionaries are listed in Reporting API.
Examples
Basic usage
const options = {
types: ["deprecation"],
buffered: true,
};
const observer = new ReportingObserver((reports, observer) => {
reportBtn.onclick = () => displayReports(reports);
}, options);
observer.observe();
// …
const records = observer.takeRecords();
console.log(records);
Specifications
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
