From cb3aa3927c9a49100e3de52ddbe82754fe7c9378 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 29 Oct 2021 00:39:42 +0900 Subject: [PATCH 1/2] null --- src/client/scripts/unison-reload.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/scripts/unison-reload.ts b/src/client/scripts/unison-reload.ts index 745a0a7a1d..59af584c1b 100644 --- a/src/client/scripts/unison-reload.ts +++ b/src/client/scripts/unison-reload.ts @@ -1,7 +1,7 @@ // SafariがBroadcastChannel未実装なのでライブラリを使う import { BroadcastChannel } from 'broadcast-channel'; -export const reloadChannel = new BroadcastChannel('reload'); +export const reloadChannel = new BroadcastChannel('reload'); // BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。 export function unisonReload(path?: string) { @@ -9,7 +9,7 @@ export function unisonReload(path?: string) { reloadChannel.postMessage(path); location.href = path; } else { - reloadChannel.postMessage('reload'); + reloadChannel.postMessage(null); location.reload(); } } From 9cfe3dfa3b8bd8725c618d50646fe04d50ec4568 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 29 Oct 2021 00:47:20 +0900 Subject: [PATCH 2/2] null --- src/client/init.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/init.ts b/src/client/init.ts index 37bfbc4f6a..2ba9b9ff04 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -92,8 +92,8 @@ document.addEventListener('touchend', () => {}, { passive: true }); // 一斉リロード reloadChannel.addEventListener('message', path => { - if (path === 'reload') location.reload(); - else location.href = path; + if (path !== null) location.href = path; + else location.reload(); }); //#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/