- From: James Dalessio <notifications@github.com>
- Date: Sun, 14 Aug 2016 14:59:26 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/836/239700349@github.com>
Sorry to necrobump guys: I think this issue was sort of sidetracked by middleware as the use case. Once you call ```event.respondWith``` afaik there is no way to fallback to the default behavior. Unfortunately for range requests this is important. Suppose I want to asynchronously get a decision whether to pull from cache, use fetch, or just fallback to the default behavior. ```javascript self.addEventListener('fetch', event => { return event.respondWith(async function () { const action = await getAction(); if (action === 'cache') { return await getFromCache(event.request); } else if (action === 'fetch') { return await fetch(event.request); } else { // How to fallback to default behavior as if I didn't call respondWith. } }); }); ``` My expectation would be that I could either resolve my `respondWith` to null or wrap with `waitUtil` and then never call `event.respondWith`. I don't see those in spec and they don't work. Has there been an update to allowing async `respondWith` or are we just waiting for ```fetch``` to get in line with the default passthrough behavior with partial content and whatnot. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/836#issuecomment-239700349
Received on Sunday, 14 August 2016 21:59:53 UTC