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
This commit is contained in:
Sam Maddock 2025-01-24 08:33:44 -05:00 committed by GitHub
parent 75eac86506
commit a467d0684e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1265 additions and 50 deletions

View file

@ -0,0 +1,34 @@
# ServiceWorkerMain
> An instance of a Service Worker representing a version of a script for a given scope.
Process: [Main](../glossary.md#main-process)
## Class: ServiceWorkerMain
Process: [Main](../glossary.md#main-process)<br />
_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.