{"id":17419577,"url":"https://github.com/bendrucker/document-visibility","last_synced_at":"2025-04-15T00:01:47.119Z","repository":{"id":57214317,"uuid":"49728951","full_name":"bendrucker/document-visibility","owner":"bendrucker","description":"Handle changes to browser document visibility using the Page Visibility API","archived":false,"fork":false,"pushed_at":"2018-11-13T19:04:38.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T08:13:59.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/bendrucker.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":"2016-01-15T15:56:54.000Z","updated_at":"2018-12-19T23:58:27.000Z","dependencies_parsed_at":"2022-08-26T13:31:08.183Z","dependency_job_id":null,"html_url":"https://github.com/bendrucker/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/bendrucker%2Fdocument-visibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fdocument-visibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fdocument-visibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fdocument-visibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bendrucker","download_url":"https://codeload.github.com/bendrucker/document-visibility/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248684980,"owners_count":21145170,"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-10-17T02:26:58.806Z","updated_at":"2025-04-15T00:01:47.070Z","avatar_url":"https://github.com/bendrucker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# document-visibility [![Build Status](https://travis-ci.org/bendrucker/document-visibility.svg?branch=master)](https://travis-ci.org/bendrucker/document-visibility)\n\n\u003e Handle changes to browser document visibility using the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API)\n\n\n## Install\n\n```\n$ npm install --save document-visibility\n```\n\n\n## Usage\n\n```js\nvar Visibility = require('document-visibility')\nvar visibility = Visibility()\n\nvisibility.visible()\n//=\u003e true/false\n\nvar unlisten = visibility.onChange(function (visible) {\n  //=\u003e true/false  \n})\n```\n\n## API\n\n#### `visibility.visible()` -\u003e `boolean`\n\nReturns the visibility of the document. If the browser does not support the visibility API, this will always be `true`.\n\n#### `visibility.onChange(fn)` -\u003e `function`\n\nReturns an unlisten function.\n\n##### fn\n\n*Required*  \nType: `function`  \nArguments: `visible`\n\nA function to call when the page visibility changes.\n\n\n## License\n\nMIT © [Ben Drucker](http://bendrucker.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fdocument-visibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbendrucker%2Fdocument-visibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fdocument-visibility/lists"}