gamepad-api
Used Gamepad API to setup wrapper for nicer usage.
Preview
https://piecioshka.github.io/gamepad-api/demo/
Usage
Installation:
npm install gamepad-api
Gamepad.on('SUPPORTED_EVENT', function () {
// do something ...
});
API / Supported events
Joysticks
joystick:left- when user use left joystickjoystick:right- when user use right joystick
Arrows
arrow:uparrow:rightarrow:downarrow:left
Shapes
shape:triangleshape:circleshape:crossshape:square
Special
special:selectspecial:startspecial:ps
Extras
extra:l1extra:l2extra:r1extra:r2
Gamepad API
More details in specification: https://www.w3.org/TR/gamepad/
Thanks
Thanks ben@daisyowl.com for https://html5gamepad.com/.