var registerSystem = require('../core/system').registerSystem;
var utils = require('../utils');

/**
 * Tracked controls system.
 * Maintain list with available tracked controllers.
 */
module.exports.System = registerSystem('tracked-controls', {
  init: function () {
    var self = this;

    this.controllers = [];

    this.updateControllerList(navigator.getGamepads && navigator.getGamepads());
    this.throttledUpdateControllerList = utils.throttle(this.updateControllerList, 500, this);

    if (!navigator.getVRDisplays) { return; }

    this.sceneEl.addEventListener('enter-vr', function () {
      navigator.getVRDisplays().then(function (displays) {
        if (displays.length) { self.vrDisplay = displays[0]; }
      });
    });
  },

  tick: function () {
    var gamepads;
    // Call getGamepads for Chrome.
    gamepads = navigator.getGamepads && navigator.getGamepads();
    this.throttledUpdateControllerList(gamepads);
  },

  /**
   * Update controller list.
   */
  updateControllerList: function (gamepads) {
    var controllers = this.controllers;
    var gamepad;
    var i;
    var prevCount;

    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);
    }
  }
});

@@ -346,59 +346,11 @@
 ist(
-navigator.getGamepads && navigator.getGamepads()
 );%0A
+
     
@@ -724,72 +724,150 @@
     
-var gamepads;%0A    // Call getGamepads for Chrome.%0A    gamepads =
+if (navigator.userAgent.indexOf('Chrome') !== -1) %7B%0A      // Call getGamepads for Chrome for it to update. Not sure if needed in future.%0A     
  nav
@@ -909,24 +909,30 @@
 Gamepads();%0A
+    %7D%0A
     this.thr
@@ -958,24 +958,16 @@
 lerList(
-gamepads
 );%0A  %7D,%0A
@@ -1042,24 +1042,16 @@
 nction (
-gamepads
 ) %7B%0A    
@@ -1103,16 +1103,34 @@
 amepad;%0A
+    var gamepads;%0A
     var 
@@ -1152,16 +1152,81 @@
 Count;%0A%0A
+    gamepads = navigator.getGamepads && navigator.getGamepads();%0A
     if (

remove spamming getGamepad calls to reduce GC (#3816)