Move bridge javascript into existing folder structure

This commit is contained in:
Adrien Maston
2026-01-08 16:22:55 +01:00
parent eae17b82b4
commit 3a43941575
9 changed files with 7 additions and 4 deletions
@@ -0,0 +1,24 @@
let top = 0
const viewportTarget = window.visualViewport || window
export const viewport = {
get top() {
return top
},
get height() {
return viewportTarget.height || window.innerHeight
}
}
function update() {
requestAnimationFrame(() => {
const styles = getComputedStyle(document.documentElement)
const customInset = styles.getPropertyValue("--custom-safe-inset-top")
const fallbackInset = styles.getPropertyValue("--safe-area-inset-top")
const insetValue = (customInset || fallbackInset).trim()
top = parseInt(insetValue || "0", 10) || 0
})
}
viewportTarget.addEventListener("resize", update)
update()