ServiceWorkerContainer
The ServiceWorkerContainer
interface of the Service Worker 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. Available only in secure contexts.
Properties
The controller
read-only property of the ServiceWorkerContainer interface represents the active ServiceWorker controlling the current page (associated with this ServiceWorkerContainer
), or null
if the page has no active or activating service worker.
The ready
read-only property of the ServiceWorkerContainer interface provides a way of delaying code execution until a service worker is active.
Functions
The getRegistration()
method of the ServiceWorkerContainer interface gets a ServiceWorkerRegistration object whose scope URL matches the provided client URL.
The getRegistration()
method of the ServiceWorkerContainer interface gets a ServiceWorkerRegistration object whose scope URL matches the provided client URL.
The getRegistrations()
method of the ServiceWorkerContainer interface gets all ServiceWorkerRegistrations associated with a ServiceWorkerContainer
, in an array.
The getRegistrations()
method of the ServiceWorkerContainer interface gets all ServiceWorkerRegistrations associated with a ServiceWorkerContainer
, in an array.
The register()
method of the ServiceWorkerContainer interface creates or updates a ServiceWorkerRegistration for the given scope.
The register()
method of the ServiceWorkerContainer interface creates or updates a ServiceWorkerRegistration for the given scope.
The startMessages()
method of the ServiceWorkerContainer interface explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g., sent via Client.postMessage()).