{"id":15063134,"url":"https://github.com/ecj222/nuxt-page-visibility","last_synced_at":"2025-10-28T23:42:51.674Z","repository":{"id":112287549,"uuid":"374599471","full_name":"ECJ222/nuxt-page-visibility","owner":"ECJ222","description":"Page visibility module for Nuxt.js","archived":false,"fork":false,"pushed_at":"2021-06-11T07:29:41.000Z","size":3851,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-19T17:14:15.676Z","etag":null,"topics":["nuxt-module","nuxtjs","pagevisibilityapi"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nuxt-page-visibility","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ECJ222.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-07T08:57:30.000Z","updated_at":"2021-07-13T07:48:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfbbeed8-a3c4-4945-b1d6-fb454ac005c2","html_url":"https://github.com/ECJ222/nuxt-page-visibility","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"f044e2dc4ff37fadc9a52c01a961a9598b4e27a3"},"previous_names":[],"tags_count":22,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ECJ222%2Fnuxt-page-visibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ECJ222%2Fnuxt-page-visibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ECJ222%2Fnuxt-page-visibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ECJ222%2Fnuxt-page-visibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ECJ222","download_url":"https://codeload.github.com/ECJ222/nuxt-page-visibility/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199244,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt-module","nuxtjs","pagevisibilityapi"],"created_at":"2024-09-24T23:51:51.000Z","updated_at":"2025-10-28T23:42:46.615Z","avatar_url":"https://github.com/ECJ222.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌫️ nuxt-page-visibility\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n\n\u003e A Nuxt.js module to detect page visibility\n\n## Table of Contents\n\n- [Requirements](#requirements)\n- [Install](#install)\n- [Getting Started](#getting-started)\n- [Usage](#usage)\n- [License](#license)\n\n## Requirements\n\n- npm\n- NuxtJS\n- NodeJS\n\n## Install\n\n```bash\n# npm\n$ npm install nuxt-page-visibility\n\n# yarn\n$ yarn add nuxt-page-visibility\n```\n\n## Getting Started\n\nAdd `'nuxt-page-visibility'` to the `modules` section of your `nuxt.config.js` file.\n\n```js\n{\n  modules: [\"nuxt-page-visibility\"];\n}\n```\n\n## Usage\n\n1. Inject the module in your `nuxt.config.js` file. See [Getting Started](#getting-started).\n2. `this.$visibility` is now available in your components. **Note** that `$visibility` returns an `object` with two properties one is `isVisible` which we would use to check if a user is focused on a page or not, While the other `isSupported` is used to check if the browser supports the Page Visibility API.\n\n```js\n{\n  ...\n  watch: {\n    $visibility: {\n      handler (page) {\n        if (page.isVisible) {\n          // do something\n        } else {\n          // do something\n        }\n      },\n      deep: true\n    }\n  }\n  ...\n}\n```\n\n## License\n\nThis project is licensed under [MIT](./LICENSE)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-page-visibility/latest.svg\n[npm-version-href]: https://npmjs.com/package/nuxt-page-visibility\n[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-page-visibility.svg\n[npm-downloads-href]: https://npmjs.com/package/nuxt-page-visibility\n[license-src]: https://img.shields.io/npm/l/nuxt-page-visibility.svg\n[license-href]: https://npmjs.com/package/nuxt-page-visibility\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecj222%2Fnuxt-page-visibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecj222%2Fnuxt-page-visibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecj222%2Fnuxt-page-visibility/lists"}