Skip to content

Commit

Permalink
Require Screenfull to be imported using require when using TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 4, 2019
1 parent 9b98fcc commit 2664e56
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
7 changes: 1 addition & 6 deletions dist/screenfull.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ declare namespace screenfull {
/**
Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to.
*/
declare const screenfull:
| (screenfull.Screenfull & {
// TODO: remove this in the next major version
default: typeof screenfull;
})
| false;
declare const screenfull: screenfull.Screenfull | false;

export = screenfull;
export as namespace screenfull;
4 changes: 1 addition & 3 deletions dist/screenfull.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}.bind(this));
},
exit: function () {
return new Promise(function (resolve) {
return new Promise(function (resolve, reject) {
if (!this.isFullscreen) {
resolve();
return;
Expand Down Expand Up @@ -170,8 +170,6 @@

if (isCommonjs) {
module.exports = screenfull;
// TODO: remove this in the next major version
module.exports.default = screenfull;
} else {
window.screenfull = screenfull;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/screenfull.min.js

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

7 changes: 1 addition & 6 deletions src/screenfull.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ declare namespace screenfull {
/**
Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to.
*/
declare const screenfull:
| (screenfull.Screenfull & {
// TODO: remove this in the next major version
default: typeof screenfull;
})
| false;
declare const screenfull: screenfull.Screenfull | false;

export = screenfull;
export as namespace screenfull;
4 changes: 1 addition & 3 deletions src/screenfull.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}.bind(this));
},
exit: function () {
return new Promise(function (resolve) {
return new Promise(function (resolve, reject) {
if (!this.isFullscreen) {
resolve();
return;
Expand Down Expand Up @@ -165,8 +165,6 @@

if (isCommonjs) {
module.exports = screenfull;
// TODO: remove this in the next major version
module.exports.default = screenfull;
} else {
window.screenfull = screenfull;
}
Expand Down

0 comments on commit 2664e56

Please sign in to comment.