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 setup>
import { useValue } from "valdres-vue"
import { presenceSelector } from "@valdres/browser-presence"
const present = useValue(presenceSelector) // Ref<boolean>
</script>
<template>{{ present ? "Active" : "Away" }}</template>
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.