Comparing version 1.0.2 to 1.1.0
@@ -12,10 +12,11 @@ 'use strict'; | ||
fullscreenchange: 4, | ||
fullscreenerror: 5 | ||
fullscreenerror: 5, | ||
fullscreen: 6 | ||
}; | ||
var webkit = ['webkitFullscreenEnabled', 'webkitFullscreenElement', 'webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitfullscreenchange', 'webkitfullscreenerror']; | ||
var webkit = ['webkitFullscreenEnabled', 'webkitFullscreenElement', 'webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitfullscreenchange', 'webkitfullscreenerror', '-webkit-full-screen']; | ||
var moz = ['mozFullScreenEnabled', 'mozFullScreenElement', 'mozRequestFullScreen', 'mozCancelFullScreen', 'mozfullscreenchange', 'mozfullscreenerror']; | ||
var moz = ['mozFullScreenEnabled', 'mozFullScreenElement', 'mozRequestFullScreen', 'mozCancelFullScreen', 'mozfullscreenchange', 'mozfullscreenerror', '-moz-full-screen']; | ||
var ms = ['msFullscreenEnabled', 'msFullscreenElement', 'msRequestFullscreen', 'msExitFullscreen', 'MSFullscreenChange', 'MSFullscreenError']; | ||
var ms = ['msFullscreenEnabled', 'msFullscreenElement', 'msRequestFullscreen', 'msExitFullscreen', 'MSFullscreenChange', 'MSFullscreenError', '-ms-fullscreen']; | ||
@@ -37,2 +38,5 @@ // so it doesn't throw if no window or document | ||
}, | ||
get fullscreenPseudoClass() { | ||
return ':' + vendor[key.fullscreen]; | ||
}, | ||
addEventListener: function addEventListener(type, handler, options) { | ||
@@ -39,0 +43,0 @@ return document.addEventListener(vendor[key[type]], handler, options); |
{ | ||
"name": "fscreen", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "fullscreen spec api in a vendor agnostic wrapper", | ||
@@ -13,3 +13,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/rafrex/fscreen.git" | ||
"url": "git+https://github.com/rafgraph/fscreen.git" | ||
}, | ||
@@ -24,8 +24,8 @@ "files": [ | ||
], | ||
"author": "Rafael Pedicini <code@rafrex.com>", | ||
"author": "Rafael Pedicini <rafael@rafgraph.dev>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/rafrex/fscreen/issues" | ||
"url": "https://github.com/rafgraph/fscreen/issues" | ||
}, | ||
"homepage": "https://github.com/rafrex/fscreen#readme", | ||
"homepage": "https://github.com/rafgraph/fscreen#readme", | ||
"devDependencies": { | ||
@@ -32,0 +32,0 @@ "babel-cli": "^6.24.1", |
# Fscreen - Fullscreen API | ||
[Live Example](http://fscreen.rafrex.com) | ||
[![npm](https://img.shields.io/npm/dm/fscreen?label=npm)](https://www.npmjs.com/package/fscreen) | ||
[Demo website](https://fscreen.rafgraph.dev) (demo code on the [`gh-pages` branch](https://github.com/rafgraph/fscreen/tree/gh-pages)) | ||
--- | ||
Vendor agnostic access to the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API). Build with the Fullscreen API as intended without worrying about vendor prefixes. | ||
@@ -19,4 +23,5 @@ | ||
fscreen.fullscreenElement === null / DOM Element; | ||
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 | ||
@@ -47,9 +52,9 @@ // mapped to: document.vendorMappedFullsceenElement | ||
fscreen.addEventListener(‘fullscreenchange’, handler, options); | ||
// replacement for: document.addEventListener(‘fullscreenchange’, handler, options) | ||
// mapped to: document.addEventListener(‘vendorMappedFullscreenchange’, handler, options) | ||
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.removeEventListener('fullscreenchange', handler, options); | ||
// replacement for: document.removeEventListener('fullscreenchange', handler, options) | ||
// mapped to: document.removeEventListener('vendorMappedFullscreenchange', handler, options) | ||
@@ -61,9 +66,16 @@ | ||
fscreen.addEventListener(‘fullscreenerror’, handler, options); | ||
// replacement for: document.addEventListener(‘fullscreenerror’, handler, options) | ||
// mapped to: document.addEventListener(‘vendorMappedFullscreenerror’, handler, options) | ||
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.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(...); | ||
``` | ||
@@ -70,0 +82,0 @@ |
@@ -8,2 +8,3 @@ const key = { | ||
fullscreenerror: 5, | ||
fullscreen: 6 | ||
}; | ||
@@ -18,2 +19,3 @@ | ||
'webkitfullscreenerror', | ||
'-webkit-full-screen', | ||
]; | ||
@@ -28,2 +30,3 @@ | ||
'mozfullscreenerror', | ||
'-moz-full-screen', | ||
]; | ||
@@ -38,2 +41,3 @@ | ||
'MSFullscreenError', | ||
'-ms-fullscreen', | ||
]; | ||
@@ -56,2 +60,3 @@ | ||
get exitFullscreen() { return document[vendor[key.exitFullscreen]].bind(document); }, | ||
get fullscreenPseudoClass() { return `:${vendor[key.fullscreen]}`; }, | ||
addEventListener: (type, handler, options) => document.addEventListener(vendor[key[type]], handler, options), | ||
@@ -58,0 +63,0 @@ removeEventListener: (type, handler, options) => document.removeEventListener(vendor[key[type]], handler, options), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10514
119
98
1