Joy Joy
A Joy-Con game controller library for the browser. Built using the Gamepad API.
To see a demo of the library, visit https://taktran.github.io/joy-joy/.
Installation
npm install joy-joy
Usage
; ; const stopPolling = ; // When done;;
Data
onGamepadConnected
/onGamepadDisconnected
> gamepad
(see Gamepad docs):
connected: true id: "Joy-Con (R) (Vendor: 057e Product: 2007)" index: 0 mapping: "" timestamp: 0 vibrationActuator: null axes: 0 0 0 0 0 0 0 0 0 12857143878936768 buttons: GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton
GamepadButton
(see GamepadButton docs):
pressed: false touched: false value: 0
startPolling
> data
:
0: connected: true id: "Joy-Con (R) (Vendor: 057e Product: 2007)" index: 0 mapping: "" timestamp: 0 vibrationActuator: null axes: 0 0 0 0 0 0 0 0 0 12857143878936768 buttons: GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton GamepadButton ...
Development
-
Install nvm
-
Use correct node version
nvm use
-
Install dependencies
npm install
-
Go to demo folder and run