standard-mapper/gamepad.js
function (event) {
    // Remove the gamepad from the list of gamepads to monitor.
    for (var i in gamepadSupport.gamepads) {
      if (gamepadSupport.gamepads[i].index === event.gamepad.index) {
        gamepadSupport.gamepads.splice(i, 1);
        break;
      }
    }

    // If no gamepads are left, stop the polling loop (but only if
    // `gamepadconnected` will get fired when a gamepad is reconnected).
    if (!gamepadSupport.gamepads.length && gamepadSupport.hasEvents) {
      gamepadSupport.stopPolling();
    }

    // Ask the tester to update the screen to remove the gamepad.
    window.tester.updateGamepads(gamepadSupport.gamepads);
  }
function (event) {
    // Remove the gamepad from the list of gamepads to monitor.
    for (var i in gamepadSupport.gamepads) {
      if (gamepadSupport.gamepads[i].index === event.gamepad.index) {
        gamepadSupport.gamepads.splice(i, 1);
        break;
      }
    }

    // If no gamepads are left, stop the polling loop (but only if
    // `gamepadconnected` will get fired when a gamepad is reconnected).
    if (!gamepadSupport.gamepads.length && gamepadSupport.hasEvents) {
      gamepadSupport.stopPolling();
    }

    // Ask the tester to update the screen to remove the gamepad.
    window.tester.updateGamepads(gamepadSupport.gamepads);
  }
function ( event ) { // Remove the gamepad from the list of gamepads to monitor. for ( var i in gamepadSupport . gamepads ) { if ( gamepadSupport . gamepads [ i ] . index === event . gamepad . index ) { gamepadSupport . gamepads . splice ( i , 1 ) ; break ; } } // If no gamepads are left, stop the polling loop (but only if // `gamepadconnected` will get fired when a gamepad is reconnected). if ( ! gamepadSupport . gamepads . length && gamepadSupport . hasEvents ) { gamepadSupport . stopPolling ( ) ; } // Ask the tester to update the screen to remove the gamepad. window . tester . updateGamepads ( gamepadSupport . gamepads ) ; }
React to the gamepad being disconnected.
React to the gamepad being disconnected .