- From: Mat Scales <notifications@github.com>
- Date: Tue, 20 Jan 2015 05:33:44 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Tuesday, 20 January 2015 13:34:11 UTC
Let's say I have the following worker: ```javascript var myCache; caches.open('my-cache').then(function (cache) { myCache = cache; }); self.oninstall = function(event) { myCache.add('index.html'); }; ``` Are there any guarantees about the order of operations? Specifically, will the promise created during script load, that sets the `myCache` variable, be resolved before the `install` event is triggered? I'm guessing that, no, this is a race condition, and you can't rely on it. But it limits the useful setup work that can be done when a script is restarted. You can't defer boilerplate stuff to `install` or `activate` for scripts that are just being restarted. --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/605
Received on Tuesday, 20 January 2015 13:34:11 UTC