MDN self-hosted library · e01.org

HID

WebHID APIwindowandworkerexceptshared

no runnable cells web-api-interface upstream source

WebHID APIwindow_and_worker_except_shared

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

Instance properties

This interface also inherits properties of its parent, EventTarget.

Instance methods

This interface also inherits methods of its parent, EventTarget.

  • getDevices()
  • : Returns a Promise that resolves with an array of connected HID devices that the user has previously been granted access to in response to a requestDevice() call.
  • requestDevice()
  • : Returns a Promise that resolves with an array of connected HIDDevice objects. Calling this function will trigger the user agent's permission flow in order to gain permission to access one selected device from the returned list of devices.

Events

  • connect
  • : Fired when an HID device is connected.
  • disconnect
  • : Fired when an HID device is disconnected.

Specifications

Browser compatibility

See also