fawazahmed0 / fawazahmed0.github.io

https://fawazahmed0.github.io/
The Unlicense
2 stars 2 forks source link

Setup Airbrake for your JavaScript application #1

Closed fawazahmed0 closed 4 years ago

fawazahmed0 commented 4 years ago

Install Airbrake in 3 easy steps:

Step 1: Add the library Install via NPM:

npm install @airbrake/browser

We also support installation via yarn.

Step 2: Import the library

Include the library via a script tag:

<script src="node_modules/@airbrake/browser/dist/airbrake.iife.js"></script>

Alternative library import methods can be found on our GitHub.

Step 3: Copy this config snippet to your app.js file

(You can find your project ID and API KEY with your project's settings):

const airbrake = new Notifier({
  projectId: <Your project ID>,
  projectKey: '<Your project API Key>',
  environment: 'production'
});

To test that Airbrake has been installed correctly in your JavaScript project, just open up the JavaScript console in your internet browser and paste in:

window.onerror("TestError: This is a test", "path/to/file.js", 123);

Going further

Visit our official GitHub repo for more info on alternative configurations and advanced options.

fawazahmed0 commented 4 years ago

I will add this later