src/components/Game.js
/*
Try to make screen fullscreen and lock orientation.
The extent to which these actions can be performed is browser dependent.
*/
Try to make screen fullscreen and lock orientation.
The extent to which these actions can be performed is browser dependent.
Try to make screen fullscreen and lock orientation . The extent to which these actions can be performed is browser dependent .
function lockScreen() {
  if (
    !(
      document.mozFullScreenEnabled ||
      document.webkitFullscreenEnabled ||
      document.fullscreenEnabled
    )
  ) {
    return;
  }
  if (typeof document.documentElement.webkitRequestFullscreen !== 'undefined') {
    document.documentElement.webkitRequestFullscreen();
  } else if (typeof document.documentElement.mozRequestFullScreen !== 'undefined') {
    document.documentElement.mozRequestFullScreen();
  }
  if (document.fullscreenElement !== null) {
    window.screen.orientation.lock('landscape-primary').catch(() => {});
  }
}
function lockScreen ( ) { if ( ! ( document . mozFullScreenEnabled || document . webkitFullscreenEnabled || document . fullscreenEnabled ) ) { return ; } if ( typeof document . documentElement . webkitRequestFullscreen !== 'undefined' ) { document . documentElement . webkitRequestFullscreen ( ) ; } else if ( typeof document . documentElement . mozRequestFullScreen !== 'undefined' ) { document . documentElement . mozRequestFullScreen ( ) ; } if ( document . fullscreenElement !== null ) { window . screen . orientation . lock ( 'landscape-primary' ) . catch ( ( ) => { } ) ; } }
Try to make screen fullscreen and lock orientation.
Try to make screen fullscreen and lock orientation .
// Chrome // Firefox // Is in fullscreen mode // Screen orientation lock currently only works properly in chrome // https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation