Implement in-unison reload (#7196)
* Resolve #6804 Implement unison reload * ✌️ * fix * Update share.vue fix Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
9bc0110b86
commit
126826eb5a
12 changed files with 89 additions and 12 deletions
10
src/client/scripts/unison-reload.ts
Normal file
10
src/client/scripts/unison-reload.ts
Normal file
|
|
@ -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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue