docs/api/service-worker-main.md
An instance of a Service Worker representing a version of a script for a given scope.
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.
serviceWorker.isDestroyed() ExperimentalReturns boolean - Whether the service worker has been destroyed.
serviceWorker.send(channel, ...args) Experimentalchannel string...args any[]Send an asynchronous message to the service worker process via channel, along with
arguments. Arguments will be serialized with the Structured Clone Algorithm,
just like postMessage, so prototype chains will not be included.
Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
The service worker process can handle the message by listening to channel with the
ipcRenderer module.
serviceWorker.startTask() ExperimentalReturns 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.
serviceWorker.ipc Readonly ExperimentalAn IpcMainServiceWorker instance scoped to the service worker.
serviceWorker.scope Readonly ExperimentalA string representing the scope URL of the service worker.
serviceWorker.scriptURL Readonly ExperimentalA string representing the script URL of the service worker.
serviceWorker.versionId Readonly ExperimentalA number representing the ID of the specific version of the service worker script in its scope.