JS for gamepad functionality?

It would be good if there were some JS examples to refer to, or a more detailed codeblock which let you define which key to bind things to.

left