CoreWebView2DedicatedWorker Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a dedicated worker in WebView2 and provides methods and properties for interacting with it, such as getting the script URI, posting messages, managing events related to the creation of child workers, termination, etc.
public class CoreWebView2DedicatedWorker
type CoreWebView2DedicatedWorker = class
Public Class CoreWebView2DedicatedWorker
- Inheritance
-
CoreWebView2DedicatedWorker
Properties
| Name | Description |
|---|---|
| ScriptUri |
A string representing the Uri of the script that the worker is executing. The Refer to the Host Name Canonicalization for
details on how normalization is performed.
The same process applies to the script URL when a worker is created from DOM API.
The |
Methods
| Name | Description |
|---|---|
| PostWebMessageAsJson(String) |
Posts the specified |
| PostWebMessageAsString(String) |
Posts a message that is a simple string rather than a JSON string representation of a JavaScript object.
This behaves in exactly the same manner as PostWebMessageAsJson(String), but the |
Events
| Name | Description |
|---|---|
| DedicatedWorkerCreated |
Subscribe to this event that gets raised when a new dedicated worker is created from a dedicated worker. A Dedicated Worker is a type of web worker that allows you to run Javascript code in the background without blocking the main thread, making them useful for tasks like heavy computations, data processing, and parallel execution. It is "dedicated" because it is linked to a single parent document and cannot be shared with other scripts. This event is raised when a dedicated worker creates a dedicated worker using the |
| Destroying |
Raised when the worker object is being destroyed. A worker object is being destroyed when the worker script is terminated or when the CoreWebView2DedicatedWorker object is being destroyed. If the worker has already been destroyed before the event handler is registered, the handler will never be called. |
| WebMessageReceived |
If the worker calls |