You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(workspaces): migrate sources to javascript workspace
* refactor(workspaces): migrate sources to javascript workspace
* ci(workspaces): update workflows for javascript workspace publishing
* Rename ESLint config and update references
Renamed .eslintrc.js to .eslintrc.cjs and updated all npm scripts in package.json to reference the new config file. Also added a features section to the JavaScript package README to highlight key capabilities.
---------
Co-authored-by: Peter Savchenko <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+3-204Lines changed: 3 additions & 204 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Hawk JavaScript Catcher
1
+
# Hawk JavaScript
2
2
3
3
Error tracking for JavaScript/TypeScript applications.
4
4
@@ -18,210 +18,9 @@ Error tracking for JavaScript/TypeScript applications.
18
18
- <imgsrc="https://cdn.svglogos.dev/logos/vue.svg"width="16"height="16"> Vue support
19
19
- <imgsrc="https://cdn.svglogos.dev/logos/react.svg"width="16"height="16"> React support
20
20
21
-
## Installation
21
+
## Packages
22
22
23
-
We recommend adding Hawk script to page above others to prevent missing any errors.
24
-
25
-
### Install via NPM or Yarn
26
-
27
-
Install package
28
-
29
-
```shell
30
-
npm install @hawk.so/javascript --save
31
-
```
32
-
33
-
```shell
34
-
yarn add @hawk.so/javascript
35
-
```
36
-
37
-
Then import `@hawk.so/javascript` module to your code.
38
-
39
-
```js
40
-
importHawkCatcherfrom'@hawk.so/javascript';
41
-
````
42
-
43
-
### Load from CDN
44
-
45
-
Get the newest bundle path from [@hawk.so/javascript](https://www.jsdelivr.com/package/npm/@hawk.so/javascript) — open site and get the link to latest distributed JS bundle.
46
-
47
-
Then require this script on your site.
48
-
49
-
```
50
-
<script src="..." async></script>
51
-
```
52
-
53
-
## Usage
54
-
55
-
### Get an Integration Token
56
-
57
-
First of all, you should register an account on [hawk.so](https://garage.hawk.so/sign-up).
58
-
59
-
Then create a Workspace and a Project inthere. You'll get an Integration Token.
60
-
61
-
### Initialize Catcher
62
-
63
-
Create `HawkCatcher` class instance when script will be ready and pass your Integration Token:
64
-
65
-
```js
66
-
const hawk = new HawkCatcher({token: 'INTEGRATION_TOKEN'});
67
-
68
-
// or
69
-
70
-
const hawk = new HawkCatcher('INTEGRATION_TOKEN');
71
-
```
72
-
73
-
Alternately, add `onload="const hawk = new HawkCatcher({token: 'INTEGRATION_TOKEN'})"` attribute to the `<script>` tag.
74
-
75
-
```html
76
-
<script src="https://cdn.rawgit.com/codex-team/hawk.javascript/master/hawk.js" onload="const hawk = new HawkCatcher({token: 'INTEGRATION_TOKEN'})"></script>
If your bundle is minified, it is useful to pass source-map files to the Hawk. After that you will see beautiful original source code lines in Hawk Garage instead of minified code.
150
-
151
-
To enable source map consuming you should do two things:
152
-
153
-
- Send the source map and the release identifier to the Hawk after you build a new version of the script. For example with the [Hawk Webpack Plugin](https://github.com/codex-team/hawk.webpack.plugin) or with cURL request.
154
-
- Pass the release identifier to the Hawk Catcher using `release` option.
155
-
156
-
## Testing and server responses
157
-
158
-
To make sure that Hawk is working right, call `test()` method from `HawkCatcher` class instance in browser's console.
159
-
`test()` method sends fake error to server. Then, open Hawk and find a test event at the Project's page.
160
-
161
-
## Sensitive data filtering
162
-
163
-
You can filter any data that you don't want to send to Hawk. Use the `beforeSend()` hook for that reason.
164
-
165
-
```js
166
-
window.hawk=newHawkCatcher({
167
-
token:'INTEGRATION TOKEN',
168
-
beforeSend(event){
169
-
if (event.user&&event.user.name){
170
-
deleteevent.user.name;
171
-
}
172
-
173
-
returnevent;
174
-
}
175
-
})
176
-
```
177
-
178
-
## Dismiss error
179
-
180
-
You can use the `beforeSend()` hook to prevent sending a particular event. Return `false` for that.
181
-
182
-
## Usage with <img src="https://cdn.svglogos.dev/logos/vue.svg" width="22"> Vue.js
183
-
184
-
Vue apps have their own error handler, so if you want to catcher errors thrown inside Vue components, you should set up a Vue integration.
185
-
186
-
Pass the Vue constructor with the initial settings:
187
-
188
-
```js
189
-
importVuefrom'vue';
190
-
191
-
consthawk=newHawkCatcher({
192
-
token:'INTEGRATION_TOKEN',
193
-
vue: Vue // the Vue constructor you tweak
194
-
});
195
-
```
196
-
197
-
or pass it any moment after Hawk Catcher was instantiated:
198
-
199
-
200
-
```js
201
-
importVuefrom'vue';
202
-
203
-
consthawk=newHawkCatcher({
204
-
token:'INTEGRATION_TOKEN',
205
-
});
206
-
207
-
hawk.connectVue(Vue)
208
-
```
209
-
210
-
211
-
## Usage with <img src="https://cdn.svglogos.dev/logos/react.svg" width="22"> React
212
-
213
-
React is suppported out of the box. No additional setup required.
214
-
215
-
Create the Hawk Catcher instance in a `index.js` file of your project.
0 commit comments