- From: Jake Archibald <notifications@github.com>
- Date: Fri, 14 Oct 2016 05:05:22 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Friday, 14 October 2016 12:06:02 UTC
@inian you can't call `respondWith` asynchronously. It'd need to be more like: ```js const pagesToControl = ["/page1.html", "/page2.html"]; self.addEventListener("fetch", function(e) { e.respondWith((function() { if (!e.clientId) return fetch(e.request); return clients.get(e.clientId).then(client => { const clientURL = new URL(client.url); if (!pagesToControl.includes(clientURL.pathname)) { return fetch(e.request); } // respond to fetch request }); }())); }); ``` -- 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/985#issuecomment-253781993
Received on Friday, 14 October 2016 12:06:02 UTC