Re: [w3c/ServiceWorker] A way to specify a pattern of destination URLs to hit/skip SW (#1454)

If we think the header state is stick to clients, does exposing the white list and the black list to client API make sense?
For example, if we can get/set the values via clients, the service worker can do something like this:

```javascript
self.addEventListener('activate', e => {
  e.waitUntil(async () => {
    (await Clients.matchAll()).forEach(client => {
      // client.fetchEventAllowedScopes == ['/previously-set-allowed-scope']
      // client.fetchEventDisallowedScopes == ['/previously-set-disallowed-scope']
      await Promise.all(
          client.setFetchEventAllowedScopes(['/foo/', '/bar/']),
          client.setFetchEventDisallowedScopes(['/foo/posts/']);
      // client.fetchEventAllowedScopes == ['/foo/', '/bar/']
      // client.fetchEventDisallowedScopes == ['/foo/posts/']
    });
  });
});
```

while I'm feeling that it might look more like the dynamic routing and be a big hammer.

-- 
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/1454#issuecomment-524149200

Received on Friday, 23 August 2019 02:35:33 UTC