This issue has been automatically relabelled type=task because type=launch-owp issues are now officially deprecated. The deprecation is because they were creating confusion about how to get launch approvals, which should be instead done via type=launch issues.
We recommend this issue be used for implementation tracking (for public visibility), but if you already have an issue for that, you may mark this as duplicate.
For more details see here: https://docs.google.com/document/d/1JA6RohjtZQc26bTrGoIE_bSXGXUDQz8vc6G0n_sZJ2o/edit
For any questions, please contact owencm, sshruthi, larforge
Hi
Hi all
I'm trying ReportingObserver like below.
report has value, but not JSON serialisable.
means `JSON.stringify(report)` only results in `{}`.
https://w3c.github.io/reporting/#concept-reports
so currently I need workaround like below.
```
if (window.ReportingObserver) {
console.log('ReportingObserver');
const observer = new ReportingObserver((reports, observer) => {
for (const report of reports) {
console.log(report.type, report.url, report.body)
const r = {
type: report.type,
url: report.url,
body: {},
}
switch(report.type) {
case "deprecation":
r.body = {
id: report.body.id,
anticipatedRemoval: report.body.anticipatedRemoval,
message: report.body.message,
sourceFile: report.body.sourceFile,
lineNumber: report.body.lineNumber,
columnNumber: report.body.columnNumber,
}
break;
case "intervention":
r.body = {
id: report.body.id,
message: report.body.message,
sourceFile: report.body.sourceFile,
lineNumber: report.body.lineNumber,
columnNumber: report.body.columnNumber,
}
break;
case "crash":
r.body = {
id: report.body.id,
reason: report.body.reason,
}
break;
}
const URL = "https://report-uri.jxck.io/report-to.cgi"
navigator.sendBeacon(URL, JSON.stringify(r))
}
}, {buffered: true})
observer.observe()
}
```
this works, but I'm happy to use JSON.stringify()
thanks
Jxck
Comment 1 by rbyers@chromium.org
, Jul 18 2017