feat: periodically update os-layout in the background

fix: remove dead code in layout detection
fixes #78
resolves #79
This commit is contained in:
2024-01-03 13:55:50 +01:00
parent 0e57e810e0
commit a1fe6f7110
2 changed files with 28 additions and 38 deletions

View File

@@ -4,7 +4,7 @@
import "$lib/style/scrollbar.scss"
import "$lib/style/tippy.scss"
import "$lib/style/theme.scss"
import {onMount} from "svelte"
import {onDestroy, onMount} from "svelte"
import {applyTheme, argbFromHex, themeFromSourceColor} from "@material/material-color-utilities"
import Navigation from "./Navigation.svelte"
import {canAutoConnect} from "$lib/serial/device"
@@ -29,9 +29,10 @@
const locale = ((browser && localStorage.getItem("locale")) as Locales) || detectLocale()
loadLocale(locale)
setLocale(locale)
let stopLayoutDetection: () => void
if (browser) {
runLayoutDetection()
stopLayoutDetection = runLayoutDetection()
tippy.setDefaultProps({
animation: "shift-away",
theme: "surface-variant",
@@ -66,6 +67,10 @@
}
})
onDestroy(() => {
stopLayoutDetection?.()
})
let webManifestLink = ""
</script>