plainJS

Libraries / UI

Ifvisible.js

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

No-build verifiedActive0 dependenciesESM + script tagTypes bundledMIT

Facts

Facts fetched 2026-10-30 by the directory sync (GitHub, npm, jsDelivr, deps.dev). Nothing here is typed by hand.
Size4.4 KB minified, 1.6 KB gzipped (dist/ifvisible.global.js)
LicenceMIT
Dependenciesnone
Last releasev3.0.0, June 2026
Last activity2026-06-12 (Active)
Stars1,952 on GitHub
FormatsES module; classic script (global ifvisible); TypeScript types in the package
CDN hits279 a month on jsDelivr
npm downloads33,750 a month
GatesG1 passed (no runtime dependencies); G2 passed (loads in a browser as it is); G3 passed (no compile-only entry points); G4 passed (open-source licence); G5 passed (not archived or deprecated). Smoke test on v3.0.0 in headless Chromium, 2026-10-30

Load it

Pin the version. The hash is computed from the file jsDelivr serves, so a changed file fails to load instead of running.

htmlscript tag, with SRI
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ifvisible.global.js"
        integrity="sha384-o9JkPdGxyoS4Q5hBIVWBHg+zgv9DS+u02J3+bzgjQsiN1Ayxbdm9jn2hySfs8nV9" crossorigin="anonymous"></script>
jsES module import
import ifvisible from "https://cdn.jsdelivr.net/npm/[email protected]/dist/ifvisible.js";
Advertisement

Entry 86 in the directory. Facts refreshed monthly; last run 2026-10-30.