Merge branch 'unison-replace' into swn
This commit is contained in:
commit
9fe29b449a
2 changed files with 4 additions and 4 deletions
|
@ -94,8 +94,8 @@ document.addEventListener('touchend', () => {}, { passive: true });
|
||||||
|
|
||||||
// 一斉リロード
|
// 一斉リロード
|
||||||
reloadChannel.addEventListener('message', path => {
|
reloadChannel.addEventListener('message', path => {
|
||||||
if (path === 'reload') location.reload();
|
if (path !== null) location.href = path;
|
||||||
else location.href = path;
|
else 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/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SafariがBroadcastChannel未実装なのでライブラリを使う
|
// SafariがBroadcastChannel未実装なのでライブラリを使う
|
||||||
import { BroadcastChannel } from 'broadcast-channel';
|
import { BroadcastChannel } from 'broadcast-channel';
|
||||||
|
|
||||||
export const reloadChannel = new BroadcastChannel<string>('reload');
|
export const reloadChannel = new BroadcastChannel<string | null>('reload');
|
||||||
|
|
||||||
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
|
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
|
||||||
export function unisonReload(path?: string) {
|
export function unisonReload(path?: string) {
|
||||||
|
@ -9,7 +9,7 @@ export function unisonReload(path?: string) {
|
||||||
reloadChannel.postMessage(path);
|
reloadChannel.postMessage(path);
|
||||||
location.href = path;
|
location.href = path;
|
||||||
} else {
|
} else {
|
||||||
reloadChannel.postMessage('reload');
|
reloadChannel.postMessage(null);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue