standard-mapper/gamepad.js
function () {
    var gamepadSupportAvailable = navigator.getGamepads ||
        !!navigator.webkitGetGamepads ||
        !!navigator.webkitGamepads;

    if (!gamepadSupportAvailable) {
      // It doesn't seem Gamepad API is available, show a message telling
      // the visitor about it.
      window.tester.showNotSupported();
    } else {
      // Check and see if gamepadconnected/gamepaddisconnected is supported.
      // If so, listen for those events and don't start polling until a
      // gamepad has been connected.
      if (gamepadSupport.hasEvents) {
        // If connection events are not supported, just start polling.
        gamepadSupport.startPolling();
      } else {
        window.addEventListener('gamepadconnected',
                                gamepadSupport.onGamepadConnect);
        window.addEventListener('gamepaddisconnected',
                                gamepadSupport.onGamepadDisconnect);
      }
    }
  }
function () {
    var gamepadSupportAvailable = navigator.getGamepads ||
        !!navigator.webkitGetGamepads ||
        !!navigator.webkitGamepads;

    if (!gamepadSupportAvailable) {
      // It doesn't seem Gamepad API is available, show a message telling
      // the visitor about it.
      window.tester.showNotSupported();
    } else {
      // Check and see if gamepadconnected/gamepaddisconnected is supported.
      // If so, listen for those events and don't start polling until a
      // gamepad has been connected.
      if (gamepadSupport.hasEvents) {
        // If connection events are not supported, just start polling.
        gamepadSupport.startPolling();
      } else {
        window.addEventListener('gamepadconnected',
                                gamepadSupport.onGamepadConnect);
        window.addEventListener('gamepaddisconnected',
                                gamepadSupport.onGamepadDisconnect);
      }
    }
  }
function ( ) { var gamepadSupportAvailable = navigator . getGamepads || ! ! navigator . webkitGetGamepads || ! ! navigator . webkitGamepads ; if ( ! gamepadSupportAvailable ) { // It doesn't seem Gamepad API is available, show a message telling // the visitor about it. window . tester . showNotSupported ( ) ; } else { // Check and see if gamepadconnected/gamepaddisconnected is supported. // If so, listen for those events and don't start polling until a // gamepad has been connected. if ( gamepadSupport . hasEvents ) { // If connection events are not supported, just start polling. gamepadSupport . startPolling ( ) ; } else { window . addEventListener ( 'gamepadconnected' , gamepadSupport . onGamepadConnect ) ; window . addEventListener ( 'gamepaddisconnected' , gamepadSupport . onGamepadDisconnect ) ; } } }
Initialize support for Gamepad API.
Initialize support for Gamepad API .