fscreen

WebJar for fscreen

License

License

MIT
Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

github-com-rafrex-fscreen
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

fscreen
WebJar for fscreen
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/rafrex/fscreen

Download github-com-rafrex-fscreen

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/github-com-rafrex-fscreen/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>github-com-rafrex-fscreen</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-rafrex-fscreen/
implementation 'org.webjars.npm:github-com-rafrex-fscreen:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-rafrex-fscreen/
implementation ("org.webjars.npm:github-com-rafrex-fscreen:1.0.2")
'org.webjars.npm:github-com-rafrex-fscreen:jar:1.0.2'
<dependency org="org.webjars.npm" name="github-com-rafrex-fscreen" rev="1.0.2">
  <artifact name="github-com-rafrex-fscreen" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='github-com-rafrex-fscreen', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "github-com-rafrex-fscreen" % "1.0.2"
[org.webjars.npm/github-com-rafrex-fscreen "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Fscreen - Fullscreen API

npm

Demo website (demo code on the gh-pages branch)


Vendor agnostic access to the Fullscreen API. Build with the Fullscreen API as intended without worrying about vendor prefixes.

$ npm install --save fscreen
import fscreen from 'fscreen';

fscreen.fullscreenEnabled === true / false;
// boolean to tell if fullscreen mode is supported
// replacement for: document.fullscreenEnabled
// mapped to: document.vendorMappedFullscreenEnabled

fscreen.fullscreenElement === null / undefined / DOM Element;
// null if not in fullscreen mode, or the DOM element that's in fullscreen mode
// (if fullscreen is not supported by the device it will be undefined)
// replacement for: document.fullscreenElement
// mapped to: document.vendorMappedFullsceenElement
// note that fscreen.fullscreenElement uses a getter to retrieve the element
// each time the property is accessed.


fscreen.requestFullscreen(element);
// replacement for: element.requestFullscreen()
// mapped to: element.vendorMappedRequestFullscreen()

fscreen.requestFullscreenFunction(element);
// replacement for: element.requestFullscreen - without calling the function
// mapped to: element.vendorMappedRequestFullscreen

fscreen.exitFullscreen();
// replacement for: document.exitFullscreen()
// mapped to: document.vendorMappedExitFullscreen()
// note that fscreen.exitFullscreen is mapped to
// document.vendorMappedExitFullscreen - without calling the function


fscreen.onfullscreenchange = handler;
// replacement for: document.onfullscreenchange = handler
// mapped to: document.vendorMappedOnfullscreenchange = handler

fscreen.addEventListener('fullscreenchange', handler, options);
// replacement for: document.addEventListener('fullscreenchange', handler, options)
// mapped to: document.addEventListener('vendorMappedFullscreenchange', handler, options)

fscreen.removeEventListener('fullscreenchange', handler, options);
// replacement for: document.removeEventListener('fullscreenchange', handler, options)
// mapped to: document.removeEventListener('vendorMappedFullscreenchange', handler, options)


fscreen.onfullscreenerror = handler;
// replacement for: document.onfullscreenerror = handler
// mapped to: document.vendorMappedOnfullscreenerror = handler

fscreen.addEventListener('fullscreenerror', handler, options);
// replacement for: document.addEventListener('fullscreenerror', handler, options)
// mapped to: document.addEventListener('vendorMappedFullscreenerror', handler, options)

fscreen.removeEventListener('fullscreenerror', handler, options);
// replacement for: document.removeEventListener('fullscreenerror', handler, options)
// mapped to: document.removeEventListener('vendorMappedFullscreenerror', handler, options)


fscreen.fullscreenPseudoClass;
// returns: the vendorMapped fullscreen Pseudo Class
// i.e. :fullscreen, :-webkit-full-screen, :-moz-full-screen, :-ms-fullscreen
// Can be used to find any elements that are fullscreen using the vendorMapped Pseudo Class 
// e.g. document.querySelectorAll(fscreen.fullscreenPseudoClass).forEach(...);

Usage

Use it just like the spec API.

if (fscreen.fullscreenEnabled) {
 fscreen.addEventListener('fullscreenchange', handler, false);
 fscreen.requestFullscreen(element);
}

function handler() {
 if (fscreen.fullscreenElement !== null) {
   console.log('Entered fullscreen mode');
 } else {
   console.log('Exited fullscreen mode');
 }
}

Versions

Version
1.0.2