Secure context

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

The USBConnectionEvent() constructor creates a new USBConnectionEvent object which is passed to USB.onconnect and USB.ondisconnect. This constructor is not typically used, it is created by the browser in response to the connection and disconnection of a USB device.


new USBConnectionEvent(type, USBConnectionEventInit);


A string representing the name of the event. One of:
  • connect
  • disconnect
An object including the following:
A USBDevice
An object representing the USB device being connected or disconnected.
bubbles Optional
A Boolean indicating whether the event bubbles. The default is false.
cancelable Optional
A Boolean indicating whether the event can be cancelled. The default is false.
composed Optional
A Boolean indicating whether the event will trigger listeners outside of a shadow root (see Event.composed for more details). The default is false.


Specification Status Comment
The definition of 'USBConnectionEvent()' in that specification.
Draft Initial definition.

Browser compatibility

No compatibility data found for api.USBConnectionEvent.USBConnectionEvent.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.