Nucleus Powered Mitochondria
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@jsilvermist/fullscreen-api

0.2.1 • Public • Published

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.

Installation

npm install --save @jsilvermist/fullscreen-api

Usage

You can use the default import to import all methods using simplified names:

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:

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:

function handleChange() {...}
function handleError() {...}
 
<fullscreen.addListener|addFullscreenListener>('change', handleChange);
<fullscreen.addListener|addFullscreenListener>('error', handleError);
 
<fullscreen.removeListener|removeFullscreenListener>('change', handleChange);
<fullscreen.removeListener|removeFullscreenListener>('error', handleError);

Install

npm i @jsilvermist/fullscreen-api

DownloadsWeekly Downloads

3

Version

0.2.1

License

MIT

Unpacked Size

6.53 kB

Total Files

4

Last publish

Collaborators

  • avatar