[w3c/ServiceWorker] Provide `navigation` event (#1028)

Despite the use case in [Jake's comment](https://github.com/w3c/ServiceWorker/issues/993#issuecomment-255329512) for issue #993, there is another interesting case in this [manifest issue](https://github.com/w3c/manifest/issues/479) about _singleton_ apps. Perhaps something like:

```
self.onnavigation = event => {
  const clients = await self.clients.matchAll({ type: 'window' });
  if (clients.length === 1) {
    clients[0].navigate(event.request.url);
    clients[0].focus();
    event.preventDefault();
  }
};
```

If the app is a SPA, then SW could use `#` routes or post a message to the client to start an in-site navigation.

-- 
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/1028

Received on Wednesday, 14 December 2016 19:43:43 UTC