Skip to main content
Photography of Alvaro Montoro being a doofus
Alvaro Montoro

HTML Surfer

illustration of a gamepad

Do you have a gamepad? Help me test a library!

javascript api webdev showdev gamepad

This past week I got to learn and play with the Gamepad API (which allows to control gamepads/joysticks on the browser using JavaScript)... and I must say, it was a lot of fun.

After running tests and creating some demos, the result was GameController.js: a lightweight JS library to simplify the API interface and make it easier to use on web applications and games. Still at an early stage, but fully working.

...But I have a problem: the gamepad I used for testing is a SNES replica that only has 8 buttons and 1 joystick/axe, and the API supports a standard 17-button and 2 joysticks/axes gamepad. So I haven't been able to test the whole functionality ?

If you have a gamepad/joystick for your computer, please give it a try. Test the demo page below or the ones on github, and let me know what you think. All feedback is welcome.

Thanks! ?

Demo (you may need to open it on a new page):

  • Select button will reset the game
  • Start button will start a new game after reset
  • Right/Left joystick/buttons to move the paddle

If you don't have a gamepad, you can see a video of the API at work here and another video here.

Article originally published on