Gamepad.on is not a function

I don’t know if this will help you, but this is how I got numpad to work, I use flags, I also have an inGame flag.

//global variables
let previousInputState = {
left: 0,
right: 0,
up: 0,
down: 0,
ok: 0,
back: 0
}

let inputState = {
left: 0,
right: 0,
up: 0,
down: 0,
ok: 0,
back: 0
}

//my if statement
if (inputState.up == 1 && previousInputState.up == 0){//do whatever};
//reset
previousInputState.up = inputState.up;

my key handling JS file:
HandleKeys.js (8.9 KB)