{"id":22891604,"url":"https://github.com/hanford/react-document-visibility","last_synced_at":"2025-05-07T16:55:36.992Z","repository":{"id":65483343,"uuid":"138906213","full_name":"hanford/react-document-visibility","owner":"hanford","description":"functional react component that re renders and informs children when the document is currently focussed or not","archived":false,"fork":false,"pushed_at":"2018-06-27T16:30:29.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T10:29:51.533Z","etag":null,"topics":["document","javascript","javascript-library","react","react-component","visibility"],"latest_commit_sha":null,"homepage":"","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/hanford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-27T16:23:47.000Z","updated_at":"2024-04-25T09:03:57.000Z","dependencies_parsed_at":"2023-01-25T11:15:24.301Z","dependency_job_id":null,"html_url":"https://github.com/hanford/react-document-visibility","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-document-visibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-document-visibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-document-visibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Freact-document-visibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanford","download_url":"https://codeload.github.com/hanford/react-document-visibility/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252921953,"owners_count":21825632,"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":["document","javascript","javascript-library","react","react-component","visibility"],"created_at":"2024-12-13T22:34:38.492Z","updated_at":"2025-05-07T16:55:36.956Z","avatar_url":"https://github.com/hanford.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-document-visibility\n\n[![npm package][npm-badge]][npm]\n\n## Installation\n\n```sh\n$ npm install --save react-document-visibility\n```\n\n```sh\n$ yarn add react-document-visibility\n```\n\n### child is a function\n\nTo use the `Visbility` component, you pass it a function. It will be called whenever the state changes, with the new value of `visible`.\n\n```js\nimport Visbility from 'react-document-visibility'\n\nconst Component = () =\u003e (\n  \u003cVisbility\u003e\n    {({ visible }) =\u003e (\n      \u003ch1\u003e{`Document is visible: ${visible}`}\u003c/h1\u003e\n    )}\n  \u003c/Visbility\u003e\n)\n\nexport default Component\n```\n\n[npm-badge]: https://img.shields.io/npm/v/react-document-visibility.png?style=flat-square\n[npm]: https://www.npmjs.org/package/react-document-visibility\n\nQuestions? Feedback? [Please let me know](https://github.com/hanford/react-document-visibility/issues/new)\n\n## License (MIT)\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\nCopyright © 2017-present [Jack Hanford](http://jackhanford.com), jackhanford@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Freact-document-visibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanford%2Freact-document-visibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Freact-document-visibility/lists"}