CoreWebView2ServiceWorkerRegistration 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 service worker registration in WebView2 and provides methods and properties for interacting with it, such as getting the scope URI, active service worker, listening for service worker activation, unregistering events, etc.
public class CoreWebView2ServiceWorkerRegistration
type CoreWebView2ServiceWorkerRegistration = class
Public Class CoreWebView2ServiceWorkerRegistration
- Inheritance
-
CoreWebView2ServiceWorkerRegistration
Properties
| Name | Description |
|---|---|
| ActiveServiceWorker |
The active service worker that was created. If there is no active service worker,
it returns This corresponds to the |
| Origin |
A string representing the URI of the origin where the worker is executing. If a worker is created with Refer to the Host Name Canonicalization for details on how normalization is performed. |
| ScopeUri |
The When registering a service worker, if no scope is specified, it defaults to the
directory where the service worker script resides. For example, if the script is
located at Refer to the Host Name Canonicalization for
details on how normalization is performed.
The same process applies to the The |
| TopLevelOrigin |
A string representing the URI of the top-level document that the worker is associated with. If a worker is created with Refer to the Host Name Canonicalization section for details on how normalization is performed. When CustomDataPartitionId is set, the For more details, see CustomDataPartitionId. |
Events
| Name | Description |
|---|---|
| ServiceWorkerActivated |
This event is raised when a service worker is activated. A service worker is activated when its script has been successfully registered and it is ready to control the pages within the scope of the registration. This event is also raised when an updated version of a service worker reaches the active state. In such a case, the existing CoreWebView2ServiceWorker object is being destroyed, and this event is raised with a new CoreWebView2ServiceWorker object representing the updated service worker. The active service worker is the one that receives fetch and message events for the pages it controls. See the Service Worker documentation for more information. If you register for the |
| Unregistering |
Raised when the worker registration is
unregistered using the JS API |