serkanyersen/ifvisible.js
Crossbrowser & lightweight way to check if user is looking at the page or interacting with it. observed · 2026-08-28
Health v2 · maintenance only
62/100
- Activity 87
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 5220
- days_rel: n/a
- days_push: 82
- n_releases_24m: 0
Adoption not part of the score
1950 stars · 183 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A lightweight, dependency-free JavaScript library that wraps the Page Visibility API to detect whether the user is viewing the page, interacting with it, or idle. It emits events like focus, blur, idle, wakeup, and freeze/resume, and supports self-pausing intervals.
Use cases
- pause video or animations when the user switches tabs
- detect when a user goes idle and stop polling or live data streams
- resume updates when the user returns to the page
- run intervals only while the page is visible
- track user activity status in a web app
- handle browser minimize and tab switch events
- clean up visibility listeners on SPA route unmount
When to choose
- you need cross-browser tab visibility and idle detection with zero dependencies
- you want SSR-safe imports and TypeScript types out of the box
- you need smart intervals that pause when nobody is watching the page
When to avoid
- you only need the raw Page Visibility API and prefer no abstraction
- you need server-side user presence detection rather than in-browser
- you require legacy IE browser support
Facets
library · maturity stable
developer-tools web-development frontend developer-tools browser cross-platform page-visibility idle-detection page-lifecycle typescript zero-dependency ssr-safe event-emitter nodejs
3 sources
- readme: https://github.com/serkanyersen/ifvisible.js · fetched 2026-08-28 · 48eb7bbfdaba
- homepage: https://ifvisible.serkan.dev/ · fetched 2026-08-29 · daf07b4b6071
- registry_npm: https://registry.npmjs.org/ifvisible.js · fetched 2026-08-29 · 4c6173133149
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| serkanyersen/ifvisible.js | main | 62 |
For agents
markdown · JSON · MCP: product_card(name="serkanyersen/ifvisible.js")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem