Web SDK - friendlyGamepadName()

Home > rainway-sdk > friendlyGamepadName

friendlyGamepadName() function

Return a human-readable name for the given gamepad object.

This attempts to return an accurate string based on the Bluetooth vendor and product ID, on browsers that put this data in Gamepad.id. On other browsers, or if the vendor and product ID are unrecognized, it will simply return a heuristically cleaned-up version of the Gamepad.id string.


export declare function friendlyGamepadName(gamepad: Gamepad, customMapping?: Record<string, Record<string, string>>): string;


gamepadGamepadA gamepad.
customMappingRecord<string, Record<string, string>>An optional custom mapping of friendly gamepad names. If provided, it is indexed like: customMapping[vendor][product], where vendor is a 4-hex-digit Bluetooth vendor ID, and product is a 4-hex-digit Bluetooth product ID. Names in this mapping have priority over names in the default mapping.