summaryrefslogtreecommitdiff
path: root/src/client/scripts
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2021-02-17 21:36:56 +0900
committerGitHub <noreply@github.com>2021-02-17 21:36:56 +0900
commit126826eb5a05fbb7ec5044269e6a25eb04154637 (patch)
treef469a26b7cfa70564e9452e6ab582851dbb85b8a /src/client/scripts
parentFix #7212 (#7215) (diff)
downloadsharkey-126826eb5a05fbb7ec5044269e6a25eb04154637.tar.gz
sharkey-126826eb5a05fbb7ec5044269e6a25eb04154637.tar.bz2
sharkey-126826eb5a05fbb7ec5044269e6a25eb04154637.zip
Implement in-unison reload (#7196)
* Resolve #6804 Implement unison reload * :v: * fix * Update share.vue fix Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
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();
+}