From 41a0dae82532815d583316d8b777a0afbc235aad Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 7 Aug 2023 19:08:13 +0200 Subject: [PATCH] refactor: fullscreen.js -> fullscreen.ts --- src/ui/{fullscreen.js => fullscreen.ts} | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename src/ui/{fullscreen.js => fullscreen.ts} (69%) diff --git a/src/ui/fullscreen.js b/src/ui/fullscreen.ts similarity index 69% rename from src/ui/fullscreen.js rename to src/ui/fullscreen.ts index 36a2e9753..70a265120 100644 --- a/src/ui/fullscreen.js +++ b/src/ui/fullscreen.ts @@ -1,7 +1,9 @@ import * as $j from 'jquery'; export class Fullscreen { - constructor(fullscreenElement, fullscreenMode) { + fullscreenElement: any; + + constructor(fullscreenElement, fullscreenMode = false) { this.fullscreenElement = fullscreenElement; if (fullscreenMode) { fullscreenElement.addClass('fullscreenMode'); @@ -21,8 +23,14 @@ export class Fullscreen { } } -const isNativeFullscreenAPIUse = () => - document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement; +const isNativeFullscreenAPIUse = () => { + // NOTE: These properties were vendor-prefixed until very recently. + // Keeping vendor prefixes, though they make TS report an error. + return ( + // @ts-expect-error 2551 + document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement + ); +}; const disableFullscreenLayout = (fullscreenElement) => { fullscreenElement.removeClass('fullscreenMode');