ServiceWorkerRegistration Class

A service worker registration (https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface), as seen by a window or a worker. Its ServiceWorkerRegistration.Installing, ServiceWorkerRegistration.Waiting and ServiceWorkerRegistration.Active workers are updated by tasks queued by the algorithms of the registration.

public sealed class ServiceWorkerRegistration : EventTarget
Inheritance
EventTarget ServiceWorkerRegistration

Properties

NameDescription
ActiveGets the active worker, or null.
InstallingGets the installing worker, or null.
NavigationPreloadGets the navigation preload manager of the registration.
OnUpdateFoundGets or sets the event handler of the updatefound event.
ScopeGets the serialized scope URL.
UpdateViaCacheGets the update via cache mode.
WaitingGets the waiting worker, or null.

Gets the active worker, or null.

public ServiceWorker? Active { get; }

Gets the installing worker, or null.

public ServiceWorker? Installing { get; }

OnUpdateFound

ServiceWorker.cs

Gets or sets the event handler of the updatefound event.

public Action<Event>? OnUpdateFound { get; set; }

Gets the serialized scope URL.

public string Scope { get; }

UpdateViaCache

ServiceWorker.cs

Gets the waiting worker, or null.

public ServiceWorker? Waiting { get; }

Methods

NameDescription
Unregister()Unregisters the registration (https://w3c.github.io/ServiceWorker/#dom-serviceworkerregistration-unregister).
Update()Checks whether the script of the service worker changed (https://w3c.github.io/ServiceWorker/#dom-serviceworkerregistration-update).

Unregister()

ServiceWorker.cs

Unregisters the registration (https://w3c.github.io/ServiceWorker/#dom-serviceworkerregistration-unregister).

public Task<bool> Unregister()

Checks whether the script of the service worker changed (https://w3c.github.io/ServiceWorker/#dom-serviceworkerregistration-update).