summaryrefslogtreecommitdiff
path: root/src/client/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/scripts')
-rw-r--r--src/client/scripts/unison-reload.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/scripts/unison-reload.ts b/src/client/scripts/unison-reload.ts
new file mode 100644
index 0000000000..92556aefaa
--- /dev/null
+++ b/src/client/scripts/unison-reload.ts
@@ -0,0 +1,10 @@
+// SafariがBroadcastChannel未実装なのでライブラリを使う
+import { BroadcastChannel } from 'broadcast-channel';
+
+export const reloadChannel = new BroadcastChannel<'reload'>('reload');
+
+// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
+export function unisonReload() {
+ reloadChannel.postMessage('reload');
+ location.reload();
+}