Skip to content

Commit 0a8dd14

Browse files
committed
Update to 0.2.0, add README.md
1 parent cd233d1 commit 0a8dd14

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Fullscreen API Interface
2+
========================
3+
4+
A modular Fullscreen API interface that can be used without
5+
interfering with other potential polyfills added at a global level.
6+
7+
[More information about the Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
8+
9+
## Installation
10+
11+
```sh
12+
npm install --save @jsilvermist/fullscreen-api
13+
```
14+
15+
## Usage
16+
17+
You can use the default import to import all methods using simplified names:
18+
19+
```javascript
20+
import fullscreen from '@jsilvermist/fullscreen-api';
21+
22+
fullscreen.enabled;
23+
fullscreen.element;
24+
fullscreen.request(targetElement);
25+
fullscreen.exit();
26+
```
27+
28+
Or you can import individual functions based on w3 api names:
29+
30+
```javascript
31+
import { fullscreenEnabled, fullscreenElement, requestFullscreen, exitFullscreen } from '@jsilvermist/fullscreen-api';
32+
33+
fullscreenEnabled;
34+
fullscreenElement;
35+
requestFullscreen(targetElement);
36+
exitFullscreen();
37+
```
38+
39+
To maintain encapsulation and prevent side effects, there are 2 listeners provided for you to add callbacks to:
40+
41+
```javascript
42+
function handleChange() {...}
43+
function handleError() {...}
44+
45+
<fullscreen.addListener|addFullscreenListener>('change', handleChange);
46+
<fullscreen.addListener|addFullscreenListener>('error', handleError);
47+
48+
<fullscreen.removeListener|removeFullscreenListener>('change', handleChange);
49+
<fullscreen.removeListener|removeFullscreenListener>('error', handleError);
50+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsilvermist/fullscreen-api",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "A modular Fullscreen API interface",
55
"main": "fullscreen-api.js",
66
"scripts": {

0 commit comments

Comments
 (0)