Share via


CoreWebView2ServiceWorkerManager Class

Definition

public class CoreWebView2ServiceWorkerManager
type CoreWebView2ServiceWorkerManager = class
Public Class CoreWebView2ServiceWorkerManager
Inheritance
CoreWebView2ServiceWorkerManager

Methods

GetServiceWorkerRegistrationsAsync()

Gets a list of the service worker registrations under the same profile.

        This method returns a list of `CoreWebView2ServiceWorkerRegistration` objects,
        each representing a service worker registration.

        This method corresponds to the `getRegistrations` method of the `ServiceWorkerContainer`
        object in the DOM which returns a Promise that resolves to an array of
        `ServiceWorkerRegistration` objects. See the [MDN documentation]
        (https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/getRegistrations) for more information.
GetServiceWorkerRegistrationsAsync(String)

Gets the service worker registrations associated with the specified scope. If a service worker has been registered for the given scope, it gets the list of CoreWebView2ServiceWorkerRegistration objects otherwise returns empty list.

Events

ServiceWorkerRegistered

A ServiceWorker is a specific type of worker that takes a JavaScript file that can control the web-page/site that it is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion to give you complete control over how app behaves in certain situations.

        Service workers essentially act as proxy servers that sit between web
        applications, the browser, and the network (when available). They run in
        a different context from the web page, which means they have no direct access
        to the DOM. Unlike dedicated and shared workers, which may have direct access to a
        global scope shared with other scripts, service workers operate in isolation
        from the DOM, ensuring a more secure and controlled environment.

        This event is raised when a web application registers a service worker using the
        `navigator.serviceWorker.register("/sw.js")` method. See the
        [Service Worker Registration](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
        for more information.

Applies to