mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-13 10:23:08 +02:00
0e4a111f81
Resolve #7779
15 lines
504 B
TypeScript
15 lines
504 B
TypeScript
// SafariがBroadcastChannel未実装なのでライブラリを使う
|
|
import { BroadcastChannel } from 'broadcast-channel';
|
|
|
|
export const reloadChannel = new BroadcastChannel<string | null>('reload');
|
|
|
|
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
|
|
export function unisonReload(path?: string) {
|
|
if (path !== undefined) {
|
|
reloadChannel.postMessage(path);
|
|
location.href = path;
|
|
} else {
|
|
reloadChannel.postMessage(null);
|
|
location.reload();
|
|
}
|
|
}
|