I need to create an object that behaves in every way like the Gamepad
objects found in navigator.getGamepads()
, but presents specific static data rather than data about a real gamepad. How can I create such an object?
> navigator.getGamepads()[0]
Gamepad {
id: "USB Gamepad (Vendor 0079 Product: 0011)",
index: 0,
connected: true,
timestamp: 1234.567890,
mapping: "",
axes: [0, 0],
buttons: [GamepadButton, GamepadButton, GamepadButton, GamepadButton, GamepadButton, GamepadButton],
__proto__: Gamepad
}