summaryrefslogtreecommitdiff
path: root/src/web/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-21 10:01:00 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-21 10:01:00 +0900
commitc47addc973af1a685dfa39ed1e484df85a02e306 (patch)
tree91d1f1bd19ca01194acf5223b34e4b430ac5bb54 /src/web/app
parentv3177 (diff)
downloadsharkey-c47addc973af1a685dfa39ed1e484df85a02e306.tar.gz
sharkey-c47addc973af1a685dfa39ed1e484df85a02e306.tar.bz2
sharkey-c47addc973af1a685dfa39ed1e484df85a02e306.zip
#934
Diffstat (limited to 'src/web/app')
-rw-r--r--src/web/app/common/mios.ts15
-rw-r--r--src/web/app/desktop/script.ts2
-rw-r--r--src/web/app/init.ts4
-rw-r--r--src/web/app/mobile/script.ts2
4 files changed, 17 insertions, 6 deletions
diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts
index cf7841d848..838be9c370 100644
--- a/src/web/app/common/mios.ts
+++ b/src/web/app/common/mios.ts
@@ -52,9 +52,20 @@ export default class MiOS extends EventEmitter {
*/
private swRegistration: ServiceWorkerRegistration = null;
- constructor() {
+ /**
+ * Whether should register ServiceWorker
+ */
+ private shouldRegisterSw: boolean;
+
+ /**
+ * MiOSインスタンスを作成します
+ * @param shouldRegisterSw ServiceWorkerを登録するかどうか
+ */
+ constructor(shouldRegisterSw = false) {
super();
+ this.shouldRegisterSw = shouldRegisterSw;
+
//#region BIND
this.log = this.log.bind(this);
this.logInfo = this.logInfo.bind(this);
@@ -170,7 +181,7 @@ export default class MiOS extends EventEmitter {
//#region Post
// Init service worker
- this.registerSw();
+ if (this.shouldRegisterSw) this.registerSw();
//#endregion
};
diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts
index 694cb7879c..b06cb180e1 100644
--- a/src/web/app/desktop/script.ts
+++ b/src/web/app/desktop/script.ts
@@ -40,7 +40,7 @@ init(async (mios: MiOS) => {
// Start routing
route(mios);
-});
+}, true);
function registerNotifications(stream: HomeStreamManager) {
if (stream == null) return;
diff --git a/src/web/app/init.ts b/src/web/app/init.ts
index 652cbfde40..19605dc8a5 100644
--- a/src/web/app/init.ts
+++ b/src/web/app/init.ts
@@ -52,8 +52,8 @@ if (localStorage.getItem('should-refresh') == 'true') {
}
// MiOSを初期化してコールバックする
-export default callback => {
- const mios = new MiOS();
+export default (callback, sw = false) => {
+ const mios = new MiOS(sw);
mios.init(() => {
// ミックスイン初期化
diff --git a/src/web/app/mobile/script.ts b/src/web/app/mobile/script.ts
index 74dfe3dfe8..4dfff8f72f 100644
--- a/src/web/app/mobile/script.ts
+++ b/src/web/app/mobile/script.ts
@@ -19,4 +19,4 @@ init((mios: MiOS) => {
// Start routing
route(mios);
-});
+}, true);