From dff1122bd5f43a8ed3b48c846fc25d5cb5f212f3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 5 Feb 2019 14:22:52 +0900 Subject: Enable service worker --- src/client/app/sw.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/client/app/sw.js') diff --git a/src/client/app/sw.js b/src/client/app/sw.js index ccf6dc818e..c90e92a79e 100644 --- a/src/client/app/sw.js +++ b/src/client/app/sw.js @@ -4,6 +4,7 @@ import composeNotification from './common/scripts/compose-notification'; import { erase } from '../../prelude/array'; +import { clientVersion } from './config'; // キャッシュするリソース const cachee = [ @@ -16,7 +17,7 @@ self.addEventListener('install', ev => { ev.waitUntil(Promise.all([ self.skipWaiting(), // Force activate - caches.open(_VERSION_).then(cache => cache.addAll(cachee)) // Cache + caches.open(clientVersion).then(cache => cache.addAll(cachee)) // Cache ])); }); @@ -25,7 +26,7 @@ self.addEventListener('activate', ev => { // Clean up old caches ev.waitUntil( caches.keys().then(keys => Promise.all( - erase(_VERSION_, keys) + erase(clientVersion, keys) .map(key => caches.delete(key)) )) ); -- cgit v1.3.1-freya