From 548937022388d149192bd5a400bef3942da5b0b0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 28 Nov 2017 15:09:58 +0900 Subject: [PATCH] Force service worker activate --- src/web/app/sw.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/web/app/sw.js b/src/web/app/sw.js index 1b3220d23..2074ee39c 100644 --- a/src/web/app/sw.js +++ b/src/web/app/sw.js @@ -13,8 +13,10 @@ const cachee = [ self.addEventListener('install', ev => { console.info('installed'); - // Cache - ev.waitUntil(caches.open(_VERSION_).then(cache => cache.addAll(cachee))); + ev.waitUntil(Promise.all([ + self.skipWaiting(), // Force activate + caches.open(_VERSION_).then(cache => cache.addAll(cachee)) // Cache + ])); }); // アクティベートされたとき