optimized gamepad scanning
This commit is contained in:
parent
c5e78eadcc
commit
3f4fed06f3
@ -268,10 +268,12 @@ class Gamepad {
|
||||
*/
|
||||
refresh() {
|
||||
// get fresh information from DOM about gamepads
|
||||
this.gamepads = this.getNavigatorGamepads();
|
||||
|
||||
const gamepads = this.getNavigatorGamepads();
|
||||
if (gamepads !== this.gamepads) {
|
||||
this.gamepads = gamepads;
|
||||
this.buildHelpGamepadList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the help gamepad list
|
||||
@ -453,7 +455,7 @@ class Gamepad {
|
||||
* @param {*} gamepad
|
||||
*/
|
||||
loadTemplate(gamepad) {
|
||||
$.ajax(`templates/${this.type}/template.html`, {async: true}).done((template) => {
|
||||
$.ajax(`templates/${this.type}/template.html`).done((template) => {
|
||||
// inject the template HTML
|
||||
this.$gamepad.html(template);
|
||||
window.setTimeout(() => {
|
||||
@ -593,9 +595,11 @@ class Gamepad {
|
||||
}
|
||||
} else {
|
||||
this.backgroundColorIndex = color;
|
||||
this.backgroundColorName
|
||||
this.backgroundColorName;
|
||||
}
|
||||
this.backgroundColorName = this.backgroundColors[this.backgroundColorIndex];
|
||||
this.backgroundColorName = this.backgroundColors[
|
||||
this.backgroundColorIndex
|
||||
];
|
||||
|
||||
this.$body.css({
|
||||
background: this.backgroundColorName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user