njzjz / Yiqu-weapp

YiQu Wechat Mini Program, which is a social platforms on Wechat for students in East China Normal University and Shanghai Jiao Tong University.
Apache License 2.0
0 stars 0 forks source link

Setup Airbrake for your JavaScript application #2

Closed njzjz closed 5 years ago

njzjz commented 5 years ago

Install Airbrake in 2 easy steps:

Step 1: Add the library Include via CDN:

<script src="https://cdnjs.cloudflare.com/ajax/libs/airbrake-js/1.6.2/client.min.js"></script>

We also support installation via npm or Bower.

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

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

var airbrake = new airbrakeJs.Client({
  projectId: <Your project ID>,
  projectKey: '<Your project API Key>'
});

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);

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