mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-24 04:59:06 +01:00
14148f6c4a
Resolve #7779
16 lines
504 B
TypeScript
16 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();
|
|
}
|
|
}
|