# serkanyersen/ifvisible.js

Crossbrowser & lightweight way to check if user is looking at the page or interacting with it.

Repository: https://github.com/serkanyersen/ifvisible.js
Canonical: https://ross.abutalabs.com/products/ifvisiblejs
Homepage: https://ifvisible.serkan.dev/
Language: TypeScript
License: MIT
License Family: permissive
Topics: coffeescript, typescript, cross-browser, visibility, javascript, npm, library, mit, utilities
Last push: 2026-06-12T06:56:59+00:00

## Health v2 (maintenance only)
Score: 62/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 87, release rhythm 8, longevity 100
- inputs: {"age_days": 5220, "days_push": 82, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1950, forks 183 (observed 2026-08-28T04:05:58.173289+00:00)

## What it is
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
- artifact type: library
- maturity: stable
- function: developer-tools
- domain: web-development, frontend, developer-tools
- platform: browser, cross-platform
- tags: page-visibility, idle-detection, page-lifecycle, typescript, zero-dependency, ssr-safe, event-emitter, nodejs

## Member repositories
- serkanyersen/ifvisible.js (main) score 62

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:58.173289+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:06:52.876472+00:00, confidence not recorded.
  - readme: https://github.com/serkanyersen/ifvisible.js (fetched 2026-08-28T04:05:58.173289+00:00, sha 48eb7bbfdaba)
  - homepage: https://ifvisible.serkan.dev/ (fetched 2026-08-29T10:46:50.726748+00:00, sha daf07b4b6071)
  - registry_npm: https://registry.npmjs.org/ifvisible.js (fetched 2026-08-29T10:46:50.735711+00:00, sha 4c6173133149)
- Data as of 2026-08-30T08:39:29.467469+00:00.
