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