ServiceWorkerGlobalScope

The ServiceWorkerGlobalScope interface of the Service Worker API represents the global execution context of a service worker. Available only in secure contexts.

MDN Reference

Properties

Link copied to clipboard
external val clients: Clients

The clients read-only property of the ServiceWorkerGlobalScope interface returns the Clients object associated with the service worker.

Link copied to clipboard
external val cookieStore: CookieStore

The cookieStore read-only property of the ServiceWorkerGlobalScope interface returns a reference to the CookieStore object associated with this service worker.

Link copied to clipboard
open external val fonts: FontFaceSet
Link copied to clipboard
external val location: WorkerLocation

The read-only location property of the WorkerGlobalScope interface returns the WorkerLocation associated with the worker. It is a specific location object, mostly a subset of the Location for browsing scopes, but adapted to workers.

Link copied to clipboard

The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker. It is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers.

Link copied to clipboard
Link copied to clipboard

The registration read-only property of the ServiceWorkerGlobalScope interface returns a reference to the ServiceWorkerRegistration object, which represents the service worker's registration.

Link copied to clipboard

The serviceWorker read-only property of the ServiceWorkerGlobalScope interface returns a reference to the ServiceWorker object, which represents the service worker.

Functions

Link copied to clipboard
open external fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open operator external fun get(key: String): JsAny?
open operator external fun get(key: PropertyKey): JsAny?
Link copied to clipboard
open operator external fun set(key: String, value: JsAny?)
open operator external fun set(key: PropertyKey, value: JsAny?)
Link copied to clipboard

The skipWaiting() method of the ServiceWorkerGlobalScope interface forces the waiting service worker to become the active service worker.

Link copied to clipboard
external fun skipWaitingAsync(): Promise<Void>

The skipWaiting() method of the ServiceWorkerGlobalScope interface forces the waiting service worker to become the active service worker.

Link copied to clipboard
external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>