Settings: correct safe area emu hot reload
This commit is contained in:
parent
5742932c86
commit
2da07a8d01
1 changed files with 8 additions and 3 deletions
|
@ -141,11 +141,16 @@ function setupSafeAreaEmulation(name: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const $$SAFE_AREA_EMU = "$$SAFE_AREA_EMU";
|
||||||
|
|
||||||
if (import.meta.hot) {
|
if (import.meta.hot) {
|
||||||
import.meta.hot.accept((mod) => {
|
import.meta.hot.on("vite:beforeUpdate", () => {
|
||||||
if (!mod) return;
|
import.meta.hot!.data[$$SAFE_AREA_EMU] = screenOrientationCallback;
|
||||||
|
});
|
||||||
|
|
||||||
|
import.meta.hot.on("vite:afterUpdate", () => {
|
||||||
|
screenOrientationCallback = import.meta.hot?.data?.[$$SAFE_AREA_EMU];
|
||||||
if (screenOrientationCallback) {
|
if (screenOrientationCallback) {
|
||||||
mod["screenOrientationCallback"] = screenOrientationCallback;
|
|
||||||
setTimeout(screenOrientationCallback, 0);
|
setTimeout(screenOrientationCallback, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue