gamepad-info
v1.2.4
Published
Retrieve information about a gamepad
Downloads
10
Readme
gamepad-info
Retrieve information about a gamepad
Installation
$ npm install gamepad-infoExample
const getGamepadInfo = require('gamepad-info')
const gamepad = navigator.getGamepads()[0]
const gamepadName = getGamepadInfo(gamepad).name
console.log(`Your gamepad is called "${gamepadName}".`)API
getGamepadInfo(input)
Takes in a Gamepad instance or a gamepad.id string and returns an object like this:
{ name: 'Xbox 360 Wireless Receiver',
vendorId: '045e',
vendor: 'microsoft',
productId: '0719' }nameis the user-friendly name of the gamepad.vendorIdis the vendor's USB vendor ID.vendoris the vendor's name and only available for some vendors.productIdis the ID of the product and might vary between browsers.
License
MIT © Niklas Higi
