Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.79 KB

File metadata and controls

52 lines (38 loc) · 1.79 KB
title WebWorker
description Connect Web Workers with the SDK running on the main thread
notSupported
javascript.cordova
javascript.node
javascript.aws-lambda
javascript.azure-functions
javascript.connect
javascript.express
javascript.fastify
javascript.gcp-functions
javascript.hapi
javascript.hono
javascript.koa
javascript.nestjs
javascript.deno
javascript.cloudflare
javascript.bun

Import name: Sentry.webWorkerIntegration

This integration, together with Sentry.registerWorker(), establishes communication between the browser's main thread and one or more WebWorkers. It listens to worker messages from the passed workers and forwards them to the main thread.

Read our Web Worker Guide for more information.

This integration listens to a message sent from the worker when it calls Sentry.registerWorker({ self }). The purpose is to sync source map information (debugIds) between the main thread and the worker so that worker errors caught by the main thread SDK are properly mapped to the worker's source code.

Options

worker

Type: Worker | Array<Worker>

The web worker(s) to listen to. Every worker must call Sentry.registerWorker({ self }) to register itself with the SDK.

Methods

addWorker(worker: Worker)

Adds a worker to the integration, after the integraion was already initialized and added to the SDK. This is useful if you have workers that are initialized at later point in your application's lifecycle. Note that every worker must call Sentry.registerWorker({ self }) to register itself with the SDK.