Поделиться через


CoreWebView2SharedWorker Class

Definition

public class CoreWebView2SharedWorker
type CoreWebView2SharedWorker = class
Public Class CoreWebView2SharedWorker
Inheritance
CoreWebView2SharedWorker

Properties

Origin

A string representing the URI of the origin where the worker is executing.

        If a worker created with `ScriptUri` set to https://example.com/worker.js, the origin
        will be https://example.com/.

        Refer to the Host Name Canonicalization for
        details on how normalization is performed.
ScriptUri

A string representing the Uri of the script that the worker is executing.

        The `scriptUri` is a fully qualified URI, including the scheme, host, and path.
        In contrast, the `scriptURL` property of the `Worker` object in the DOM returns the relative
        URL of the script being executed by the worker. For more details on DOM API, see the
        [DOM API documentation](https://developer.mozilla.org/docs/Web/API/Worker/scriptURL).

        Refer to the Host Name Canonicalization for
        details on how normalization is performed.
        The same process applies to the `scriptURL` when a worker is created from DOM API.
        The `scriptUri` property reflects this normalization, ensuring that the URL is standardized. For example,
        `HTTPS://EXAMPLE.COM/worker.js` is canonicalized to `https://example.com/worker.js`;
        `https://bücher.de/worker.js` is canonicalized to `https://xn--bcher-kva.de/worker.js`.
TopLevelOrigin

A string representing the URI of the top-level document that the worker is associated with.

        If a worker is created with `ScriptUri` set to https://example.com/worker.js, the top-level origin
        is https://example.com/. If the same worker is created from a iframe at https://example.com/ which is hosted on
        https://example2.com/, the top-level origin is https://example2.com/.

        Refer to the Host Name Canonicalization for
        details on how normalization is performed.

        When CustomDataPartitionId is set, the `TopLevelOrigin` will be a generated
        site like guid.invalid. For example, if the top-level document is https://example.com/worker.js,
        the top-level origin will be https://guid.invalid/.

        For more details <xref data-throw-if-not-resolved="true" uid="Microsoft.Web.WebView2.Core.CoreWebView2.CustomDataPartitionId"></xref>

Events

Destroying

Add an event handler for the Destroying event that is raised when the worker object is Destroying.

        A worker object is Destroying when the worker script is terminated or when
        the `CoreWebView2SharedWorker` object is Destroying.

        If the worker has already been destroyed before the event handler is registered,
        the handler will never be called.

Applies to