class ServiceWorkerGlobalScope
package js.html
extends WorkerGlobalScope › EventTarget
Available on js
The ServiceWorkerGlobalScope
interface of the ServiceWorker API represents the global execution context of a service worker.
Documentation ServiceWorkerGlobalScope by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
onactivate:Function
An event handler fired whenever an activate
event occurs — when a ServiceWorkerRegistration
acquires a new ServiceWorkerRegistration.active
worker.
onfetch:Function
An event handler fired whenever a fetch
event occurs — when a GlobalFetch.fetch
is called.
oninstall:Function
An event handler fired whenever an install
event occurs — when a ServiceWorkerRegistration
acquires a new ServiceWorkerRegistration.installing
worker.
onmessage:Function
An event handler fired whenever a message
event occurs — when incoming messages are received. Controlled pages can use the MessagePort.postMessage()
method to send messages to service workers. The service worker can optionally send a response back via the MessagePort
exposed in event.data.port
, corresponding to the controlled page.
onnotificationclick:Function
An event handler fired whenever a notificationclick
event occurs — when a user clicks on a displayed notification.
onnotificationclose:Function
An event handler fired whenever a notificationclose
event occurs — when a user closes a displayed notification.
onpush:Function
An event handler fired whenever a push
event occurs — when a server push notification is received.
onpushsubscriptionchange:Function
An event handler fired whenever a pushsubscriptionchange
event occurs — when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time.)
read onlyregistration:ServiceWorkerRegistration
Contains the ServiceWorkerRegistration
object that represents the service worker's registration.
Methods
skipWaiting():Promise<Void>
Allows the current service worker registration to progress from waiting to active state while service worker clients are using it.
Throws:
null | DOMError |
---|