-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(js): Update web worker guide with new webWorkerIntegration
APIs
#14395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
docs/platforms/javascript/common/configuration/integrations/webworker.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: WebWorker | ||
description: "Adds source code from inline JavaScript of the current page's HTML." | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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 multiple [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)s. | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
It listens to worker messages from the passed workers and forwards them to the main thread. | ||
|
||
Read our <PlatformLink to="/best-practices/web-workers/">Web Worker Guide</PlatformLink> for more information. | ||
|
||
<Expandable title="What does this integration do?"> | ||
|
||
This integration listens to a message, sent from the worker when it calls `Sentry.registerWorker({ self })`. | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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. | ||
|
||
</Expandable> | ||
|
||
|
||
## 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 it was initialized. | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.