{"id":18850775,"url":"https://github.com/luqmanoop/use-page-visibility","last_synced_at":"2025-04-14T09:41:01.960Z","repository":{"id":51048147,"uuid":"206322483","full_name":"luqmanoop/use-page-visibility","owner":"luqmanoop","description":"Dead-simple, React hook lib for detecting page visibility 👁️","archived":false,"fork":false,"pushed_at":"2023-01-04T09:01:26.000Z","size":279,"stargazers_count":48,"open_issues_count":8,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-06T22:33:00.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://use-page-visibility.netlify.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luqmanoop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-04T13:12:15.000Z","updated_at":"2023-11-30T05:29:53.000Z","dependencies_parsed_at":"2023-02-02T06:16:15.396Z","dependency_job_id":null,"html_url":"https://github.com/luqmanoop/use-page-visibility","commit_stats":null,"previous_names":["luqmanoop/use-page-visibility","codeshifu/use-page-visibility"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqmanoop%2Fuse-page-visibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqmanoop%2Fuse-page-visibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqmanoop%2Fuse-page-visibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqmanoop%2Fuse-page-visibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luqmanoop","download_url":"https://codeload.github.com/luqmanoop/use-page-visibility/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248855694,"owners_count":21172627,"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":[],"created_at":"2024-11-08T03:31:20.031Z","updated_at":"2025-04-14T09:41:01.932Z","avatar_url":"https://github.com/luqmanoop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-page-visibility\n\nDead-simple, React hook lib for detecting page visibility 👁️\n\n## Demo\nhttps://use-page-visibility.netlify.com/\n\n## Prerequisite\n\n- [React 16.8+](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html)\n\n## Installation\n\n```bash\nnpm install use-page-visibility\n```\n\nor with yarn\n\n```bash\nyarn add use-page-visibility\n```\n\n## Usage\n\n```jsx\n...\nimport usePageVisibility from 'use-page-visibility';\n\nfunction App() {\n  const handleVisibilityChange = visible =\u003e {\n    return visible ? playVideo() : pauseVideo()\n  }\n\n  usePageVisibility(handleVisibilityChange); \n\n  return (...)\n}\n```\n\n## Api\n\n`usePageVisibility(fn, delay)`\n\n### fn\n\nType: `function`\n\nCallback function to run when page visibility changes. A boolean value (indicating whether the page is visible or not) will be passed as an argument to this function.\n\n### delay (optional)\n\nType: `number`\n\nNumber of milliseconds to wait before responding to page visibility change\n\n## Related\n\n- [react-thanos](https://github.com/codeshifu/react-thanos) - React hooks implementation of Google's \"Thanos\" easter egg\n\n## Author\n\n[Olushi Luqman Opemipo](https://twitter.com/codeshifu)\n\n## License\n\nThis project is licensed under [MIT](https://github.com/codeshifu/use-page-visibility/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluqmanoop%2Fuse-page-visibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluqmanoop%2Fuse-page-visibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluqmanoop%2Fuse-page-visibility/lists"}