- From: Jake Archibald <notifications@github.com>
- Date: Wed, 21 Jan 2015 04:04:05 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Wednesday, 21 January 2015 12:05:15 UTC
There are no guarantees here, it's the same as events in a window. You'd need to use: ```js self.oninstall = function(event) { event.waitUntil( caches.open('my-cache').then(function(myCache) { myCache.add('index.html') }) ); }; ``` ES7 async functions make it look more like sync code: ```js self.oninstall = function(event) { event.waitUntil(async function() { var myCache = await caches.open('my-cache'); return myCache.add('index.html'); }); }; ``` You can use that today using either https://github.com/google/traceur-compiler or https://6to5.org/ --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/605#issuecomment-70825821
Received on Wednesday, 21 January 2015 12:05:15 UTC