Allow active worker to immediately evict itself
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
Description
There's currently no way for an active service worker to, by itself, evict itself, i.e. immediately remove itself as a controller for any client. Such a feature would be useful for implementing some sort of service worker "heartbeat" that checks against a server.
Achieving the same result with the current service worker API requires coordinating with the installing and/or waiting worker.
To solve this issue, It would be nice to have an API with the following capabilities:
- Evict the service worker
- Stop handling any new events
- Wait for any existing tasks to complete
- Remove the worker as the controller/active worker across all clients and the registration
- Optionally provide an “ultimatum” timeout for finishing any functional events
- Optionally skipWaiting so that a waiting worker activates immediately instead of waiting for all clients to close.
For instance:
self.evict({
timeout: 10000,
skipWaiting: true
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the requested Service Worker API behavior and the related issue w3c/ServiceWorker#614. The issue provides no implementation files or tests, so research must establish the specification entry point and lifecycle semantics before defining the API, including event completion, client eviction, timeout handling, and skipWaiting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100