diff options
Diffstat (limited to 'src/client/scripts')
| -rw-r--r-- | src/client/scripts/unison-reload.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/scripts/unison-reload.ts b/src/client/scripts/unison-reload.ts index 92556aefaa..59af584c1b 100644 --- a/src/client/scripts/unison-reload.ts +++ b/src/client/scripts/unison-reload.ts @@ -1,10 +1,15 @@ // SafariがBroadcastChannel未実装なのでライブラリを使う import { BroadcastChannel } from 'broadcast-channel'; -export const reloadChannel = new BroadcastChannel<'reload'>('reload'); +export const reloadChannel = new BroadcastChannel<string | null>('reload'); // BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。 -export function unisonReload() { - reloadChannel.postMessage('reload'); - location.reload(); +export function unisonReload(path?: string) { + if (path !== undefined) { + reloadChannel.postMessage(path); + location.href = path; + } else { + reloadChannel.postMessage(null); + location.reload(); + } } |