{"id":16137337,"url":"https://github.com/presentkim/fullscreen-wrapper","last_synced_at":"2025-04-06T17:15:13.053Z","repository":{"id":57242794,"uuid":"355386995","full_name":"PresentKim/fullscreen-wrapper","owner":"PresentKim","description":"Light Wrapper for FullScreen API for cross-browser supports","archived":false,"fork":false,"pushed_at":"2022-11-22T03:11:44.000Z","size":42616,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-30T16:42:41.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/PresentKim.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":"2021-04-07T02:20:48.000Z","updated_at":"2022-11-22T02:39:07.000Z","dependencies_parsed_at":"2023-01-22T07:45:32.212Z","dependency_job_id":null,"html_url":"https://github.com/PresentKim/fullscreen-wrapper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PresentKim%2Ffullscreen-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PresentKim%2Ffullscreen-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PresentKim%2Ffullscreen-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PresentKim%2Ffullscreen-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PresentKim","download_url":"https://codeload.github.com/PresentKim/fullscreen-wrapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517919,"owners_count":20951719,"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-09T23:26:20.498Z","updated_at":"2025-04-06T17:15:13.029Z","avatar_url":"https://github.com/PresentKim.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fullscreen-wrapper\n[![npm version](https://img.shields.io/npm/v/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)\n[![npm license](https://img.shields.io/npm/l/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)\n[![npm downloads](https://img.shields.io/npm/dt/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)\n[![bundlee size](https://img.shields.io/bundlephobia/min/fullscreen-wrapper.svg?style=flat-square)](https://bundlephobia.com/package/fullscreen-wrapper)\n\nA Light Wrapper for FullScreen API for cross-browser supports\n\n## Installation\n\n\u003e ```sh\n\u003e npm install fullscreen-wrapper --save\n\u003e yarn add fullscreen-wrapper\n\u003e ```\n\n## Usage\n\n### Import library\n\n\u003e ```javascript\n\u003e import fullscreen from 'fullscreen-wrapper';\n\u003e //or\n\u003e var fullscreen = require('fullscreen-wrapper');\n\u003e ```\n\n### Check supported fullscreen features in document\n\n\u003e ```javascript\n\u003e //Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise.\n\u003e if (fullscreen.isEnabled) {\n\u003e   //do somethings\n\u003e }\n\u003e ```\n\n### Check supported fullscreen features in document\n\n\u003e ```javascript\n\u003e if (fullscreen.isEnabled) {\n\u003e   //do somethings\n\u003e }\n\u003e ```\n\nAll functions are executed only when fullscreen.isEnabled, so there is no need to check separately.  \nI think it only needs to be used when adding a fullscreen-button when fullscreen is available.\n\n### Toggle the fullscreen when document clicked\n\n\u003e ```javascript\n\u003e //In fact, it works as document.documentElement if no arguments are given.\n\u003e document.onclick = () =\u003e {\n\u003e   if (fullscreen.isFullscreen) {\n\u003e     fullscreen.exit();\n\u003e   } else {\n\u003e     fullscreen.request(document.documentElement);\n\u003e   }\n\u003e };\n\u003e ```\n\u003e\n\u003e or use `toggle()` method\n\u003e\n\u003e ```javascript\n\u003e document.onclick = () =\u003e fullscreen.toggle(document.documentElement);\n\u003e ```\n\n### Listen fullscreen change and error events\n\n\u003e Listen change\n\u003e\n\u003e ```javascript\n\u003e fullscreen.onClick(() =\u003e {\n\u003e   console.log(fullscreen.isFullscreen ? '[Fullscreen] on' : '[Fullscreen] off');\n\u003e });\n\u003e ```\n\n\u003e Listen error\n\u003e\n\u003e ```javascript\n\u003e fullscreen.onError((err) =\u003e console.log(err));\n\u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpresentkim%2Ffullscreen-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpresentkim%2Ffullscreen-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpresentkim%2Ffullscreen-wrapper/lists"}