src/systems/tracked-controls-webvr.js
function () {
    var controllers = this.controllers;
    var gamepad;
    var gamepads;
    var i;
    var prevCount;

    gamepads = navigator.getGamepads && navigator.getGamepads();
    if (!gamepads) { return; }

    prevCount = controllers.length;
    controllers.length = 0;
    for (i = 0; i < gamepads.length; ++i) {
      gamepad = gamepads[i];
      if (gamepad && gamepad.pose) {
        controllers.push(gamepad);
      }
    }

    if (controllers.length !== prevCount) {
      this.el.emit('controllersupdated', undefined, false);
    }
  }
function () {
    var controllers = this.controllers;
    var gamepad;
    var gamepads;
    var i;
    var prevCount;

    gamepads = navigator.getGamepads && navigator.getGamepads();
    if (!gamepads) { return; }

    prevCount = controllers.length;
    controllers.length = 0;
    for (i = 0; i < gamepads.length; ++i) {
      gamepad = gamepads[i];
      if (gamepad && gamepad.pose) {
        controllers.push(gamepad);
      }
    }

    if (controllers.length !== prevCount) {
      this.el.emit('controllersupdated', undefined, false);
    }
  }
function ( ) { var controllers = this . controllers ; var gamepad ; var gamepads ; var i ; var prevCount ; gamepads = navigator . getGamepads && navigator . getGamepads ( ) ; if ( ! gamepads ) { return ; } prevCount = controllers . length ; controllers . length = 0 ; for ( i = 0 ; i < gamepads . length ; ++ i ) { gamepad = gamepads [ i ] ; if ( gamepad && gamepad . pose ) { controllers . push ( gamepad ) ; } } if ( controllers . length !== prevCount ) { this . el . emit ( 'controllersupdated' , undefined , false ) ; } }
Update controller list.
Update controller list .