screenfull
Advanced tools
Comparing version 3.3.3 to 4.0.0
/*! | ||
* screenfull | ||
* v3.3.3 - 2018-09-04 | ||
* v4.0.0 - 2018-12-15 | ||
* (c) Sindre Sorhus; MIT License | ||
@@ -87,25 +87,39 @@ */ | ||
request: function (elem) { | ||
var request = fn.requestFullscreen; | ||
return new Promise(function (resolve) { | ||
var request = fn.requestFullscreen; | ||
elem = elem || document.documentElement; | ||
var onFullScreenEntered = function () { | ||
this.off('change', onFullScreenEntered); | ||
resolve(); | ||
}.bind(this); | ||
// Work around Safari 5.1 bug: reports support for | ||
// keyboard in fullscreen even though it doesn't. | ||
// Browser sniffing, since the alternative with | ||
// setTimeout is even worse. | ||
if (/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)) { | ||
elem[request](); | ||
} else { | ||
elem[request](keyboardAllowed ? Element.ALLOW_KEYBOARD_INPUT : {}); | ||
} | ||
elem = elem || document.documentElement; | ||
// Work around Safari 5.1 bug: reports support for | ||
// keyboard in fullscreen even though it doesn't. | ||
// Browser sniffing, since the alternative with | ||
// setTimeout is even worse. | ||
if (/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)) { | ||
elem[request](); | ||
} else { | ||
elem[request](keyboardAllowed ? Element.ALLOW_KEYBOARD_INPUT : {}); | ||
} | ||
this.on('change', onFullScreenEntered); | ||
}.bind(this)); | ||
}, | ||
exit: function () { | ||
document[fn.exitFullscreen](); | ||
return new Promise(function (resolve) { | ||
var onFullScreenExit = function () { | ||
this.off('change', onFullScreenExit); | ||
resolve(); | ||
}.bind(this); | ||
document[fn.exitFullscreen](); | ||
this.on('change', onFullScreenExit); | ||
}.bind(this)); | ||
}, | ||
toggle: function (elem) { | ||
if (this.isFullscreen) { | ||
this.exit(); | ||
} else { | ||
this.request(elem); | ||
} | ||
return this.isFullscreen ? this.exit() : this.request(elem); | ||
}, | ||
@@ -112,0 +126,0 @@ onchange: function (callback) { |
{ | ||
"name": "screenfull", | ||
"version": "3.3.3", | ||
"version": "4.0.0", | ||
"description": "Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.", | ||
@@ -26,4 +26,4 @@ "license": "MIT", | ||
"grunt-contrib-concat": "^1.0.0", | ||
"grunt-contrib-uglify": "^2.0.0", | ||
"load-grunt-tasks": "^3.3.0", | ||
"grunt-contrib-uglify": "^4.0.0", | ||
"load-grunt-tasks": "^4.0.0", | ||
"xo": "^0.16.0" | ||
@@ -30,0 +30,0 @@ }, |
@@ -28,3 +28,3 @@ # screenfull.js | ||
``` | ||
$ npm install --save screenfull | ||
$ npm install screenfull | ||
``` | ||
@@ -72,6 +72,7 @@ | ||
**Note:** In order to use this package in Internet Explorer, you need a [`Promise` polyfill](https://github.com/stefanpenner/es6-promise). | ||
## Documentation | ||
### Examples | ||
@@ -198,2 +199,4 @@ | ||
Returns a promise that resolves after the element enters fullscreen. | ||
#### .exit() | ||
@@ -203,2 +206,4 @@ | ||
Returns a promise that resolves after the element exits fullscreen. | ||
#### .toggle() | ||
@@ -208,2 +213,4 @@ | ||
Returns a promise that resolves after the element enters/exits fullscreen. | ||
#### .on(event, function) | ||
@@ -210,0 +217,0 @@ |
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
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
12938
162
286