Re: [w3c/ServiceWorker] provide a way to execute work after browser has consumed a response (#1397)

> I think it should be called for fallback cases as well. If sites don't want that they can avoid registering their completion work in those cases.

I agree. That said, both afterResponse and responded names seem to convey that this only happens in case the fetch event is responded. Your initial proposed name 'complete' seems somehow more accurate since we are talking of completion of a fetch task and completion handlers.

With regards to responded vs. afterResponse, I am not intimate enough with service worker scripts to have strong feelings either way.

> I think we could have the responded promise resolve with the consumed Response. If they want an unconsumed Response the SW script would have to do their own clone() and pass the duplicate into their completion work handler via a closure.

The completion handler might take benefit of knowing whether:
- respondWith is not called
- respondWith is called with a response, or a promise resolving to a response
- respondWith is called but no response is given, thus leading to a network error

-- 
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/1397#issuecomment-479537722

Received on Wednesday, 3 April 2019 15:25:26 UTC