# fullscreen-wrapper

> Light Wrapper for FullScreen API for cross-browser supports

Latest version **1.1.3** (published 2022-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install fullscreen-wrapper
pnpm add fullscreen-wrapper
yarn add fullscreen-wrapper
bun add fullscreen-wrapper
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-11-22 |
| First published | 2021-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | PresentKim |
| Maintainers | presentkim |
| Keywords | html, browser, polyfill, wrapper, fullscreen, typescript |

## Links

- npm: https://www.npmjs.com/package/fullscreen-wrapper
- Repository: https://github.com/PresentKim/fullscreen-wrapper
- Issues: https://github.com/PresentKim/fullscreen-wrapper/issues
- Funding: https://www.patreon.com/PresentKim
- npm.io page: https://npm.io/package/fullscreen-wrapper

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2022-11-22
- 1.1.2 — 2022-11-22
- 1.1.1 — 2022-11-22
- 1.1.0 — 2021-11-02
- 1.0.4 — 2021-04-09
- 1.0.3 — 2021-04-09
- 1.0.2 — 2021-04-09
- 1.0.1 — 2021-04-07
- 1.0.0 — 2021-04-07

## README

# fullscreen-wrapper
[![npm version](https://img.shields.io/npm/v/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)
[![npm license](https://img.shields.io/npm/l/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)
[![npm downloads](https://img.shields.io/npm/dt/fullscreen-wrapper.svg?style=flat-square)](https://www.npmjs.com/package/fullscreen-wrapper)
[![bundlee size](https://img.shields.io/bundlephobia/min/fullscreen-wrapper.svg?style=flat-square)]()

A Light Wrapper for FullScreen API for cross-browser supports

## Installation

> ```sh
> npm install fullscreen-wrapper --save
> yarn add fullscreen-wrapper
> ```

## Usage

### Import library

> ```javascript
> import fullscreen from 'fullscreen-wrapper';
> //or
> var fullscreen = require('fullscreen-wrapper');
> ```

### Check supported fullscreen features in document

> ```javascript
> //Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise.
> if (fullscreen.isEnabled) {
>   //do somethings
> }
> ```

### Check supported fullscreen features in document

> ```javascript
> if (fullscreen.isEnabled) {
>   //do somethings
> }
> ```

All functions are executed only when fullscreen.isEnabled, so there is no need to check separately.  
I think it only needs to be used when adding a fullscreen-button when fullscreen is available.

### Toggle the fullscreen when document clicked

> ```javascript
> //In fact, it works as document.documentElement if no arguments are given.
> document.onclick = () => {
>   if (fullscreen.isFullscreen) {
>     fullscreen.exit();
>   } else {
>     fullscreen.request(document.documentElement);
>   }
> };
> ```
>
> or use `toggle()` method
>
> ```javascript
> document.onclick = () => fullscreen.toggle(document.documentElement);
> ```

### Listen fullscreen change and error events

> Listen change
>
> ```javascript
> fullscreen.onClick(() => {
>   console.log(fullscreen.isFullscreen ? '[Fullscreen] on' : '[Fullscreen] off');
> });
> ```

> Listen error
>
> ```javascript
> fullscreen.onError((err) => console.log(err));
> ```

---
_Source: https://npm.io/package/fullscreen-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
