Re: [w3c/ServiceWorker] Provide a way to skipWaiting when the last tab refreshes (#993)

My idea around the `navigation` event:

```js
self.addEventListener('navigation', event => {
  event.waitUntil(p);
});
```

…which would pause the navigation (delaying the fetch) until p resolved. This would allow developers to do something like:

```js
self.addEventListener('navigation', event => {
  if (registration.waiting) {
    event.waitUntil(
      clients.matchAll().then(clients => {
        if (clients.length < 2) {
          return registration.waiting.skipWaiting();
        }
      })
    );
  }
});
```

…the idea that the navigation would be delayed until the waiting worker activates, so the navigation request would go through the new worker.

However, it's not clear to my how this would play with the concurrent request proposal.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/993#issuecomment-255329512

Received on Friday, 21 October 2016 08:56:39 UTC