CoreWebView2ServiceWorkerRegistration.ServiceWorkerActivated Event
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.
Adds an event handler for the ServiceWorkerActivated event.
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 destroying, 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](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/active)
documentation for more information.
If you register for the `ServiceWorkerActivated` event and the registration already
has an active worker, the event handler is not called immediately. Instead, it waits
for the next activation event to occur. Therefore, you should first check if an active
service worker is running by using the `ActiveServiceWorker` property.
public event EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2ServiceWorkerActivatedEventArgs> ServiceWorkerActivated;
member this.ServiceWorkerActivated : EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2ServiceWorkerActivatedEventArgs>
Public Custom Event ServiceWorkerActivated As EventHandler(Of CoreWebView2ServiceWorkerActivatedEventArgs)