-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathmain.ts
More file actions
26 lines (21 loc) · 761 Bytes
/
main.ts
File metadata and controls
26 lines (21 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import MyWorker from './worker.ts?worker';
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: import.meta.env.PUBLIC_E2E_TEST_DSN,
environment: import.meta.env.MODE || 'development',
tracesSampleRate: 1.0,
debug: true,
integrations: [Sentry.browserTracingIntegration()],
tunnel: 'http://localhost:3031/', // proxy server
});
const worker = new MyWorker();
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }));
worker.addEventListener('message', event => {
// this is part of the test, do not delete
console.log('received message from worker:', event.data.msg);
});
document.querySelector<HTMLButtonElement>('#trigger-error')!.addEventListener('click', () => {
worker.postMessage({
msg: 'TRIGGER_ERROR',
});
});