HID

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HID interface provides methods for connecting to HID devices, listing attached HID devices and event handlers for connected HID devices.

Properties

This interface also inherits properties of its parent, EventTarget.

Event handlers

HID.onconnect
Fired when an HID device is connected.
HID.ondisconnect
Fired when an HID device is disconnected.

Methods

This interface also inherits methods of its parent, EventTarget.

getDevices()
Returns a Promise that resolves with an array of connected HIDDevice objects.
requestDevice()
Returns a Promise that resolves with an array of connected HIDDevice objects from the HID device selected from popup.
You can only select one HID device from the popup at a time from this Promise, but the array might contain multiple HIDDevices.

Specifications

Specification Status Comment
WebHID API
The definition of 'HID' in that specification.
Draft Initial definition.

Browser compatibility

BCD tables only load in the browser

See also