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