electron/docs/api/service-worker-main.md
Sam Maddock a467d0684e
feat: ServiceWorkerMain (#45232)
* feat: ServiceWorkerMain

* refactor: disconnect remote

* handle version_info_ nullptr case

* initiate finish request when possible and enumerate errors

* explicit name for test method

* oops

* fix: wait for redundant version to stop before destroying

* docs: clarify when undefined is returned

* chore: remove extra semicolons
2025-01-24 08:33:44 -05:00

1 KiB

ServiceWorkerMain

An instance of a Service Worker representing a version of a script for a given scope.

Process: Main

Class: ServiceWorkerMain

Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

Instance Methods

serviceWorker.isDestroyed() Experimental

Returns boolean - Whether the service worker has been destroyed.

serviceWorker.startTask() Experimental

Returns Object:

  • end Function - Method to call when the task has ended. If never called, the service won't terminate while otherwise idle.

Initiate a task to keep the service worker alive until ended.

Instance Properties

serviceWorker.scope Readonly Experimental

A string representing the scope URL of the service worker.

serviceWorker.versionId Readonly Experimental

A number representing the ID of the specific version of the service worker script in its scope.