diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-02-05 14:22:52 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-02-05 14:22:52 +0900 |
| commit | dff1122bd5f43a8ed3b48c846fc25d5cb5f212f3 (patch) | |
| tree | e29c956ab078fef12a4e40c1d7bd0d428261c5c0 | |
| parent | Remove unused declare (diff) | |
| download | sharkey-dff1122bd5f43a8ed3b48c846fc25d5cb5f212f3.tar.gz sharkey-dff1122bd5f43a8ed3b48c846fc25d5cb5f212f3.tar.bz2 sharkey-dff1122bd5f43a8ed3b48c846fc25d5cb5f212f3.zip | |
Enable service worker
| -rw-r--r-- | src/client/app/mios.ts | 4 | ||||
| -rw-r--r-- | src/client/app/sw.js | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts index dc550b6f70..83f62a502a 100644 --- a/src/client/app/mios.ts +++ b/src/client/app/mios.ts @@ -4,7 +4,7 @@ import { EventEmitter } from 'eventemitter3'; import * as uuid from 'uuid'; import initStore from './store'; -import { apiUrl, clientVersion as version, lang } from './config'; +import { apiUrl, clientVersion as version } from './config'; import Progress from './common/scripts/loading'; import Err from './common/views/components/connect-failed.vue'; @@ -172,7 +172,7 @@ export default class MiOS extends EventEmitter { callback(); // Init service worker - //if (this.shouldRegisterSw) this.registerSw(); + if (this.shouldRegisterSw) this.registerSw(); }; // キャッシュがあったとき 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)) )) ); |