# ai/visibilityjs

Wrapper for the Page Visibility API

Repository: https://github.com/ai/visibilityjs
Canonical: https://ross.abutalabs.com/products/visibilityjs
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2024-01-11T16:41:43+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5554, "days_push": 965, "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 1839, forks 106 (observed 2026-08-28T04:05:42.886995+00:00)

## What it is
Visibility.js is a JavaScript wrapper around the browser Page Visibility API that hides vendor prefixes and adds high-level helpers. It lets developers run timers and callbacks only when the page is visible, and detect hidden or prerendering states.

## Use cases
- run countdown animations only when the tab is visible
- reduce polling frequency for AJAX requests in background tabs
- stop video or slideshow playback when the user switches tabs
- avoid counting prerendered pages as visits in analytics
- pause heavy calculations while the page is hidden

## When to choose
- you need visibility-aware timers or polling in a browser app
- you want a simple cross-browser wrapper with fallbacks for old browsers
- you need to detect prerendering to avoid wasted work

## When to avoid
- you only target modern browsers and prefer using the native Page Visibility API directly
- you need visibility detection outside the browser (Node.js or mobile native)
- you need a maintained library with frequent updates

## Facets
- artifact type: library
- maturity: maintenance
- function: developer-tools, middleware
- domain: web-development, frontend, browser-extensions
- platform: browser
- tags: page-visibility-api, polyfill, timers, browser-api-wrapper, javascript, nodejs

## Member repositories
- ai/visibilityjs (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:42.886995+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:18:14.361636+00:00, confidence not recorded.
  - readme: https://github.com/ai/visibilityjs (fetched 2026-08-28T04:05:42.886995+00:00, sha 46576c2d27ea)
  - registry_npm: https://registry.npmjs.org/visibilityjs (fetched 2026-08-29T10:57:14.748932+00:00, sha e8a7b8ee1970)
- Data as of 2026-08-30T08:39:29.467469+00:00.
