org.scalajs.dom.experimental.serviceworkers
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
MDN
Returns the CacheStorage object associated with the service worker.
Returns the CacheStorage object associated with the service worker.
MDN
Returns the Clients object associated with the service worker.
Returns the Clients object associated with the service worker.
MDN
The close() method of the WorkerGlobalScope interface discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope.
The close() method of the WorkerGlobalScope interface discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope.
MDN
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order.
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().
MDN
The importScripts() method of the WorkerGlobalScope interface imports one or more scripts into the worker's scope.
The importScripts() method of the WorkerGlobalScope interface imports one or more scripts into the worker's scope.
MDN
The location read-only property of the WorkerGlobalScope interface returns the WorkerLocation associated with the worker.
The location read-only 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.
MDN
The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker.
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.
MDN
The onerror property of the WorkerGlobalScope interface represents an EventHandler to be called when the error event occurs and bubbles through the Worker.
The onerror property of the WorkerGlobalScope interface represents an EventHandler to be called when the error event occurs and bubbles through the Worker.
MDN
An event handler fired whenever an activate event occurs (when the service worker activates).
An event handler fired whenever an activate event occurs (when the service worker activates). This happens after installation, when the page to be controlled by the service worker refreshes.
MDN
An event handler fired whenever a fetch event occurs — when a fetch() is called.
An event handler fired whenever a fetch event occurs — when a fetch() is called.
MDN
An event handler fired whenever an install event occurs — when a ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.installing worker.
An event handler fired whenever an install event occurs — when a ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.installing worker.
MDN
The onlanguagechange property of the WorkerGlobalScope interface represents an EventHandler to be called when the languagechange event occurs and bubbles through the Worker.
The onlanguagechange property of the WorkerGlobalScope interface represents an EventHandler to be called when the languagechange event occurs and bubbles through the Worker.
MDN
An event handler fired whenever a message event occurs — when incoming messages are received.
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.
MDN
The onoffline property of the WorkerGlobalScope interface represents an EventHandler to be called when the offline event occurs and bubbles through the Worker.
The onoffline property of the WorkerGlobalScope interface represents an EventHandler to be called when the offline event occurs and bubbles through the Worker.
MDN
The ononline property of the WorkerGlobalScope interface represents an EventHandler to be called when the online event occurs and bubbles through the Worker.
The ononline property of the WorkerGlobalScope interface represents an EventHandler to be called when the online event occurs and bubbles through the Worker.
MDN
The registration read-only property of the ServiceWorkerGlobalScope interface returns a reference to the ServiceWorkerRegistration object, which represents the service worker's registration.
Removes the event listener previously registered with EventTarget.addEventListener.
Removes the event listener previously registered with EventTarget.addEventListener.
MDN
The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself.
The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, or ServiceWorkerGlobalScope.
MDN
Forces the waiting service worker to become the active service worker.
Forces the waiting service worker to become the active service worker. This method can be used with Clients.claim to ensure that updates to the underlying service worker take effect immediately for both the current client and all other active clients.
MDN
The ServiceWorkerGlobalScope interface of the ServiceWorker API represents the global execution context of a service worker.
Developers should keep in mind that the ServiceWorker.state is not persisted across the termination/restart cycle, so each event handler should assume it's being invoked with a bare, default global state.
Once successfully registered, a service worker can and will be terminated when idle to conserve memory and processor power. An active service worker is automatically restarted to respond to events, such as ServiceWorkerGlobalScope.onfetch or ServiceWorkerGlobalScope.onmessage.
Additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used.
MDN