Skip to content

Commit

Permalink
Generate dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 15, 2018
1 parent 539d314 commit 653b75d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
54 changes: 34 additions & 20 deletions dist/screenfull.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* screenfull
* v3.3.3 - 2018-09-04
* v4.0.0 - 2018-12-15
* (c) Sindre Sorhus; MIT License
*/
(function () {
Expand Down Expand Up @@ -84,29 +84,43 @@

var screenfull = {
request: function (elem) {
var request = fn.requestFullscreen;

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 : {});
}
return new Promise(function (resolve) {
var request = fn.requestFullscreen;

var onFullScreenEntered = function () {
this.off('change', onFullScreenEntered);
resolve();
}.bind(this);

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);
},
onchange: function (callback) {
this.on('change', callback);
Expand Down
4 changes: 2 additions & 2 deletions dist/screenfull.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/screenfull.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}

this.on('change', onFullScreenEntered);
}.bind(this))
}.bind(this));
},
exit: function () {
return new Promise(function (resolve) {
Expand All @@ -115,11 +115,7 @@
}.bind(this));
},
toggle: function (elem) {
if (this.isFullscreen) {
return this.exit();
} else {
return this.request(elem);
}
return this.isFullscreen ? this.exit() : this.request(elem);
},
onchange: function (callback) {
this.on('change', callback);
Expand Down

0 comments on commit 653b75d

Please sign in to comment.