This commit is contained in:
parent
912b0afd01
commit
a7142f334c
|
@ -58,6 +58,7 @@ import { makeHotkey } from './scripts/hotkey';
|
|||
import { search } from './scripts/search';
|
||||
import { getThemes } from './theme-store';
|
||||
import { initializeSw } from './scripts/initialize-sw';
|
||||
import { reloadChannel } from './scripts/unison-reload';
|
||||
|
||||
console.info(`Misskey v${version}`);
|
||||
|
||||
|
@ -105,6 +106,9 @@ if (defaultStore.state.reportError && !_DEV_) {
|
|||
// タッチデバイスでCSSの:hoverを機能させる
|
||||
document.addEventListener('touchend', () => {}, { passive: true });
|
||||
|
||||
// 一斉リロード
|
||||
reloadChannel.addEventListener('message', () => location.reload());
|
||||
|
||||
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
||||
// TODO: いつの日にか消したい
|
||||
const vh = window.innerHeight * 0.01;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
// SafariがBroadcastChannel未実装なのでライブラリを使う
|
||||
import { BroadcastChannel } from 'broadcast-channel';
|
||||
|
||||
const ch = new BroadcastChannel<boolean | undefined>('reload');
|
||||
export const reloadChannel = new BroadcastChannel<'reload'>('reload');
|
||||
|
||||
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
|
||||
export function unisonReload(forcedReload?: boolean) {
|
||||
ch.postMessage(forcedReload);
|
||||
location.reload(forcedReload as boolean);
|
||||
export function unisonReload() {
|
||||
reloadChannel.postMessage('reload');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
ch.addEventListener('message', forcedReload => location.reload(forcedReload as boolean));
|
||||
|
|
Loading…
Reference in New Issue