function DebugTemplate(gamepad) { return { $name: $('#info-name .value'), $vendor: $('#info-vendor .value'), $product: $('#info-product .value'), $timestamp: $('#info-timestamp .value'), $index: $('#info-index .value'), $mapping: $('#info-mapping .value'), $rumble: $('#info-rumble .value'), $axes: $('.axes .container'), $buttons: $('.buttons .container'), activeGamepad: gamepad.getActive(), init: function () { if (!this.activeGamepad) { return; } const { name, vendor, product } = gamepad.toGamepadInfo(this.activeGamepad.id); this.$name.html(name).attr('title', name); this.$vendor.html(vendor); this.$product.html(product); this.updateTimestamp(); this.$index.html(this.activeGamepad.index); this.$mapping.html(this.activeGamepad.mapping || 'N/A'); this.$rumble.html( this.activeGamepad.vibrationActuator ? this.activeGamepad.vibrationActuator.type : 'N/A' ); this.initAxes(); this.initButtons(); gamepad.updateButton = ($button) => this.updateElem($button); gamepad.updateAxis = ($axis) => this.updateElem($axis, 6); }, initAxes: function () { for ( let axisIndex = 0; axisIndex < this.activeGamepad.axes.length; axisIndex++ ) { this.$axes.append(`