MENU
ReportingObserver
The ReportingObserver interface of the Reporting API allows you to collect and access reports.
let options = {
types: ['deprecation','intervention','crash'],
buffered: true, // observe reports generated before observer?
}
let observer = new ReportingObserver(function(reports, observer) {
console.log(reports);
}, options);
observer.observe();
console.log(observer.takeRecords());
Why is that useful? Until now, deprecation and intervention warnings were only available in the DevTools as console messages. Interventions, in particular, are only triggered by various real-world constraints like device and network conditions. Thus, you may never even see these messages when developing/testing a site locally.
ReportingObserver provides the solution to this problem. When users experience potential issues in the wild, we can be notified about them.