Last active
February 6, 2024 13:07
-
-
Save mcsolha/f8042f88258f5a5ab4a9069e8ce10eeb to your computer and use it in GitHub Desktop.
new-relic-browser global typing
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
/** | |
* Ensure the browser agent is present on every page you want to monitor! | |
* | |
* Refs: | |
* https://forum.newrelic.com/s/hubtopic/aAX8W0000008eQTWAY/how-to-import-newrelic-for-react-app-on-typescript | |
* https://docs.newrelic.com/docs/browser/browser-monitoring/installation/install-browser-monitoring-agent/ | |
* https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-d-ts.html | |
* | |
* Steps: | |
* Enable browser agent on the page to be monitored | |
* | |
* npm install --save @types/new-relic-browser | |
* (https://www.npmjs.com/package/@types/new-relic-browser) | |
* | |
* Use this global type file to enable newrelic namespace on every typescript file in the project | |
*/ | |
import NewRelicBrowser from "new-relic-browser" | |
declare global { | |
interface Window { | |
newrelic: typeof NewRelicBrowser | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 🚀