Created
July 19, 2018 23:42
-
-
Save ebidel/4180e7c2d24ce58c5b39941202072f61 to your computer and use it in GitHub Desktop.
Using a ReportingObserver to watch for deprecation warnings on page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author ebidel@ (Eric Bidelman) | |
* License Apache-2.0 | |
*/ | |
// Drop this in the DevTools console: | |
(new ReportingObserver((reports, observer) => { | |
console.warn('This page is using deprecated APIs or features:'); | |
const deprecations = reports.map(report => { | |
return { | |
url: report.url, | |
message: report.body.message, | |
lineNumber: report.body.lineNumber || '-', | |
colNumber: report.body.columnNumber || '-', | |
anticipatedRemoval: report.body.anticipatedRemoval ? (new Date(report.body.anticipatedRemoval)).toLocaleDateString() : '-', | |
}; | |
}); | |
console.table(deprecations); | |
}, {types: ['deprecation'], buffered: true})).observe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment