- From: Ben Kelly <notifications@github.com>
- Date: Wed, 27 Jul 2016 18:53:54 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/935/235775927@github.com>
I guess the "waiting for all" here: > Wait until the result of waiting for all of extendLifetimePromises settles. Explicitly links to the Promise.all() algorithm. So I guess this is defined and this should work: ``` addEventListener('fetch', e => { let respondWithPromise = fetch(e.request); respondWithPromise.then(response => { let clone = response.clone(); e.waitUntil(caches.open('db').then(cache => { return cache.put(e.request, clone); }); }); e.respondWith(respondWithPromise); }); ``` But this would trigger a throwing waitUntil(): ``` addEventListener('fetch', e => { let respondWithPromise = fetch(e.request); e.respondWith(respondWithPromise); respondWithPromise.then(response => { let clone = response.clone(); e.waitUntil(caches.open('db').then(cache => { return cache.put(e.request, clone); }); }); }); ``` This is fine with me since its clearly defined. Jake did suggest in person, though, that maybe we should wait a micro task turn to allow both of these cases to work. Thoughts? --- 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/935#issuecomment-235775927
Received on Thursday, 28 July 2016 01:54:28 UTC