browser-presence
Read-only boolean for "is the user actually here": true when the tab is visible and the window is focused. Composes browser-visibility and browser-focus.
Install
bun add @valdres/browser-presence
Live example
Loading demo…
Usage
<script>
import { watch } from "valdres-svelte"
import { presenceSelector } from "@valdres/browser-presence"
const present = watch(presenceSelector)
</script>
{present.value ? "Active" : "Away"}
Exports
| Export | Kind | Type |
|---|---|---|
presenceSelector | selector (read-only) | boolean |
Cross-framework
presenceSelector is a global selector — read it with store.get / store.sub in plain JS. It recomputes whenever the visibility or focus subscription fires.