- From: Salvador de la Puente González <notifications@github.com>
- Date: Wed, 21 Sep 2016 00:05:20 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Wednesday, 21 September 2016 07:05:51 UTC
I was thinking on @annevk proposal for `fetchOptions`. You're right on this affects `fetch` standard and it was clear to me when we make it accessible from clients. Perhaps this proposal is more complicated but what about providing a `window.fetchPolicies` namespace (exposed to Service Workers) and keep it separated from Service Workers. ```js // set or reconfigure window.fetchPolicies.setNavigationPreload({ headerValue: 'true', scope: '/one-scope' }); window.fetchPolicies.setNavigationPreload({ headerValue: 'true', scope: '/other/scope' }); // clear window.fetchPolicies.clearNavigationPreload({ scope: '/' }); // access to response. self.onfetch = evt => { evt.respondWith(evt.navigationPreload || fetch(event.request)); }; ``` With ergonomics in mind, navigation preload could be set at the same time you register a Service Worker. ```js navigator.serviceWorker.register('sw.js', { scope: '/one/scope/', navigationPreload: 'true' }); ``` What do you think? -- 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/920#issuecomment-248528824
Received on Wednesday, 21 September 2016 07:05:51 UTC