w3c / w3c/ServiceWorker

serviceworker.skipWaiting

Open
#1,016 4 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

apr-2017-f2f
Dominant language
Bikeshed
Stars
3.6k
Forks
324
Avg merge
14d 22h
Merged PRs (30d)
1

Description

Allowing:

const reg = await navigator.serviceWorker.ready;
if (reg.waiting) {
  await reg.waiting.skipWaiting();
  location.reload();
}

Usecase: The new service worker has installed, I've shown a message to the user like "New version found. Update now?", which they have clicked.

Currently developers have to postMessage to the service worker for this behaviour.

It's also an opportunity for us to rethink when skipWaiting should resolve in this case. It could resolve once the service worker has begun activating.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the service worker API sequence in the issue and compare it with the current postMessage workaround. Determine the intended activation and resolution semantics for waiting.skipWaiting(), then document the agreed behavior and any required specification changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.