File tree 1 file changed +10
-2
lines changed
packages/melonjs/src/system
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,11 @@ export const hasFullscreenSupport =
189
189
( prefixed ( "fullscreenEnabled" , globalThis . document ) ||
190
190
globalThis . document . mozFullScreenEnabled ) ;
191
191
192
- let exitFullScreen = hasFullscreenSupport ? document . exitFullscreen ( ) : null ;
192
+ if ( hasFullscreenSupport === true ) {
193
+ globalThis . document . exitFullscreen =
194
+ prefixed ( "cancelFullScreen" , globalThis . document ) ||
195
+ prefixed ( "exitFullscreen" , globalThis . document ) ;
196
+ }
193
197
194
198
/**
195
199
* Device WebAudio Support
@@ -508,7 +512,11 @@ export function requestFullscreen(element) {
508
512
* Exit fullscreen mode. Requires fullscreen support from the browser/device.
509
513
* @memberof device
510
514
*/
511
- export { exitFullScreen } ;
515
+ export function exitFullscreen ( ) {
516
+ if ( hasFullscreenSupport && isFullscreen ( ) ) {
517
+ globalThis . document . exitFullscreen ( ) ;
518
+ }
519
+ }
512
520
513
521
/**
514
522
* Return a string representing the orientation of the device screen.
You can’t perform that action at this time.
0 commit comments