ServiceWorker
Types
client
The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. See Client on MDN
type client = {id: string, url: string}Record fields
clients
The Clients interface provides access to Client objects. Access it via self.clients within a service worker. See Clients on MDN
type clientsnavigationPreloadManager
type navigationPreloadManager = private {}navigationPreloadState
type navigationPreloadState = { mutable enabled?: bool, mutable headerValue?: string,}Record fields
enabled
headerValue
registrationOptions
type registrationOptions = { mutable scope?: string, mutable type_?: WebWorkersTypes.workerType, mutable updateViaCache?: serviceWorkerUpdateViaCache,}Record fields
scope
type_
updateViaCache
requestInfo
type requestInfo = unknownserviceWorker
This WebApiServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique WebApiServiceWorker object. See WebApiServiceWorker on MDN
type serviceWorker = private { scriptURL: string, state: serviceWorkerState,}Record fields
serviceWorkerContainer
The ServiceWorkerContainer interface of the WebApiServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. See ServiceWorkerContainer on MDN
type serviceWorkerContainer = private { controller: Null.t<serviceWorker>, ready: promise<serviceWorkerRegistration>,}Record fields
serviceWorkerGlobalScope
The ServiceWorkerGlobalScope interface of the Service Worker API represents the global execution context of a service worker. See ServiceWorkerGlobalScope on MDN
type serviceWorkerGlobalScope = private { caches: WebWorkersTypes.cacheStorage, crossOriginIsolated: bool, clients: clients, registration: serviceWorkerRegistration,}Record fields
serviceWorkerRegistration
This WebApiServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. See ServiceWorkerRegistration on MDN
type serviceWorkerRegistration = private { installing: Null.t<serviceWorker>, waiting: Null.t<serviceWorker>, active: Null.t<serviceWorker>, navigationPreload: navigationPreloadManager, scope: string, updateViaCache: serviceWorkerUpdateViaCache, pushManager: PushTypes.pushManager,}Record fields
serviceWorkerState
type serviceWorkerState = | @as("activated") Activated | @as("activating") Activating | @as("installed") Installed | @as("installing") Installing | @as("parsed") Parsed | @as("redundant") RedundantserviceWorkerUpdateViaCache
type serviceWorkerUpdateViaCache = | @as("all") All | @as("imports") Imports | @as("none") NonewindowClient
The WindowClient interface of the WebApiServiceWorker API represents the scope of a service worker client that is a document in a browsing context, controlled by an active worker. See WindowClient on MDN
type windowClient = {id: string, url: string}Record fields
workerType
type workerType = | @as("classic") Classic | @as("module") Module