Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsilvermist/fullscreen-api
A modular Fullscreen API interface
https://github.com/jsilvermist/fullscreen-api
Last synced: 18 days ago
JSON representation
A modular Fullscreen API interface
- Host: GitHub
- URL: https://github.com/jsilvermist/fullscreen-api
- Owner: jsilvermist
- License: mit
- Created: 2018-05-19T01:44:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-28T02:09:43.000Z (over 5 years ago)
- Last Synced: 2024-12-15T19:54:35.274Z (27 days ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Fullscreen API Interface
========================A modular Fullscreen API interface (mind the double 'interface') that can be
used without interfering with other potential polyfills added at a global level.[More information about the Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
## Installation
```sh
npm install --save @jsilvermist/fullscreen-api
```## Usage
You can use the default import to import all methods using simplified names:
```javascript
import fullscreen from '@jsilvermist/fullscreen-api';fullscreen.enabled;
fullscreen.element;
fullscreen.request(targetElement);
fullscreen.exit();
```Or you can import individual functions based on w3 api names:
```javascript
import { fullscreenEnabled, fullscreenElement, requestFullscreen, exitFullscreen } from '@jsilvermist/fullscreen-api';fullscreenEnabled;
fullscreenElement;
requestFullscreen(targetElement);
exitFullscreen();
```To maintain encapsulation and prevent side effects, there are 2 listeners provided for you to add callbacks to:
```javascript
function handleChange() {...}
function handleError() {...}('change', handleChange);
('error', handleError);('change', handleChange);
('error', handleError);
```