Gamepad constructor

Gamepad()

Creates a new Gamepad manager.

It automatically listens for gamepad connection and disconnection events and attempts to map connected gamepads to available ports.

Typically, you don't instantiate this class yourself. Instead, you use the app.gamepad member provided by the App class.

Implementation

Gamepad() {
  web.window.addEventListener('gamepadconnected', _connectGamepadHandler.toJS);
  web.window.addEventListener('gamepaddisconnected', _disconnectGamepadHandler.toJS);
  for (var gamepad in _getGamepads()) {
    _connectGamepad(gamepad);
  }
}