ServiceWorkerGlobalScope Class

The global object of a service worker (https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface): it receives the lifecycle events (install, activate) and the functional events (fetch, message) of its service worker. It runs on the thread of the service worker (see WorkerGlobalScope).

public sealed class ServiceWorkerGlobalScope : WorkerGlobalScope
Inheritance
WorkerGlobalScope ServiceWorkerGlobalScope

Properties

NameDescription
ClientsGets the clients of the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-clients).
CookieStoreGets the Cookie Store API of the service worker (https://cookiestore.spec.whatwg.org/#dom-serviceworkerglobalscope-cookiestore): the script-visible cookies of its script URL.
OnActivateGets or sets the event handler of the activate event.
OnCanMakePaymentGets or sets the event handler of the canmakepayment event (see CanMakePaymentEvent).
OnCookieChangeGets or sets the event handler of the cookiechange event (see CookieStoreManager).
OnFetchGets or sets the event handler of the fetch event.
OnInstallGets or sets the event handler of the install event.
OnMessageGets or sets the event handler of the message event.
OnMessageErrorGets or sets the event handler of the messageerror event.
OnNotificationClickGets or sets the event handler of the notificationclick event (see Notification.Click).
OnNotificationCloseGets or sets the event handler of the notificationclose event (see Notification.Dismiss).
OnPaymentRequestGets or sets the event handler of the paymentrequest event (see PaymentRequestEvent).
RegistrationGets the registration of the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-registration).
ServiceWorkerGets the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-serviceworker).

Gets the clients of the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-clients).

public Clients Clients { get; }

Gets the Cookie Store API of the service worker (https://cookiestore.spec.whatwg.org/#dom-serviceworkerglobalscope-cookiestore): the script-visible cookies of its script URL.

public CookieStore CookieStore { get; }

Gets or sets the event handler of the activate event.

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

OnCanMakePayment

PaymentHandler.cs

Gets or sets the event handler of the canmakepayment event (see CanMakePaymentEvent).

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

Gets or sets the event handler of the cookiechange event (see CookieStoreManager).

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

Gets or sets the event handler of the fetch event.

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

Gets or sets the event handler of the install event.

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

Gets or sets the event handler of the message event.

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

Gets or sets the event handler of the messageerror event.

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

OnNotificationClick

ServiceWorkerGlobalScope.cs

Gets or sets the event handler of the notificationclick event (see Notification.Click).

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

OnNotificationClose

ServiceWorkerGlobalScope.cs

Gets or sets the event handler of the notificationclose event (see Notification.Dismiss).

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

OnPaymentRequest

PaymentHandler.cs

Gets or sets the event handler of the paymentrequest event (see PaymentRequestEvent).

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

Gets the registration of the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-registration).

public ServiceWorkerRegistration Registration { get; }

Gets the service worker (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-serviceworker).

public ServiceWorker ServiceWorker { get; }

Methods

NameDescription
SkipWaiting()Activates the service worker without waiting for the clients of the active worker to be unloaded (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-skipwaiting).

Activates the service worker without waiting for the clients of the active worker to be unloaded (https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-skipwaiting).

public Task SkipWaiting()