- From: Jon Walsh <notifications@github.com>
- Date: Fri, 26 Aug 2016 21:50:14 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/756/242895993@github.com>
__My use case:__ App has multiple languages. Each can optionally be downloaded for offline use. Therefore, do not want to download all languages during SW install. App uses `postMessage` to tell SW when a new language should be added to the offline list. SW both downloads the new language and does a full update of all cached responses (in case API has changed and new language is using the new API). __Where global variable comes in:__ I need a locking mechanism to prevent two updates happening at the same time. I could store a value in IDB, but what if that lock value is set to `true` and the update process fails without setting it back to `false`? Then no other update will happen as SW thinks one is still in progress. Instead, I plan to have a global `UPDATE_IN_PROGRESS` in SW, defaulting to `false`. Then, even if the update process dies, the value will reset to `false` when the SW is killed. Is this a good or bad idea? And is there an alternative if SWs will allow multiple instances? -- 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/756#issuecomment-242895993
Received on Saturday, 27 August 2016 04:50:45 UTC