Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.62 KB

File metadata and controls

46 lines (30 loc) · 1.62 KB
title HID
slug Web/API/HID
page-type web-api-interface
status
experimental
browser-compat api.HID

{{securecontext_header}}{{APIRef("WebHID API")}}{{SeeCompatTable}}{{AvailableInWorkers("window_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.

{{InheritanceDiagram}}

Instance properties

This interface also inherits properties of its parent, {{domxref("EventTarget")}}.

Instance methods

This interface also inherits methods of its parent, {{domxref("EventTarget")}}.

  • {{domxref("HID.getDevices","getDevices()")}} {{Experimental_Inline}}
    • : Returns a {{jsxref("Promise")}} that resolves with an array of connected HID devices that the user has previously been granted access to in response to a {{domxref("HID.requestDevice","requestDevice()")}} call.
  • {{domxref("HID.requestDevice","requestDevice()")}} {{Experimental_Inline}}
    • : Returns a {{jsxref("Promise")}} that resolves with an array of connected {{domxref("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

  • {{domxref("HID.connect_event", "connect")}} {{Experimental_Inline}}
    • : Fired when an HID device is connected.
  • {{domxref("HID.disconnect_event", "disconnect")}} {{Experimental_Inline}}
    • : Fired when an HID device is disconnected.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also