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
import { useValue } from "valdres-react"
import { presenceSelector } from "@valdres/browser-presence"
function PresenceDot() {
const present = useValue(presenceSelector)
return <span>{present ? "Active" : "Away"}</span>
}
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.