browser-window
Tracks the browser window's inner size, updating on every resize. Exposed as a single global atom.
Install
bun add @valdres/browser-window
Live example
Loading demo…
Usage
import { watch } from "valdres-svelte"
import { windowSizeAtom } from "@valdres/browser-window"
const size = watch(windowSizeAtom) // size.value.width / size.value.height
Exports
| Export | Kind | Type |
|---|---|---|
windowSizeAtom | atom (read-only) | { innerWidth, innerHeight, outerWidth, outerHeight } |
Cross-framework
A global atom — works in every framework, with the resize listener attached only while something is subscribed.