HIDConnectionEvent()

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The HIDConnectionEvent() constructor creates a new HIDConnectionEvent object. Typically this constructor is not used as events are created when an input report is received.

Syntax

new HIDConnectionEvent(type, HIDConnectionEventInit);

Parameters

type

A DOMString with one of "connect" or "disconnect".

HIDConnectionEventInit

A dictionary including the following fields:

device

The HIDDevice instance representing the device sending the input report.

bubbles Optional

A boolean value indicating whether the event bubbles. The default is false.

cancelable Optional

A boolean value indicating whether the event can be cancelled. The default is false.

composed Optional

A boolean value indicating whether the event will trigger listeners outside of a shadow root (see Event.composed for more details). The default is false.

Specifications

Specification
WebHID API
# dom-hidconnectionevent-constructor

Browser compatibility

BCD tables only load in the browser