dom / latest / usbconnectionevent / usbconnectionevent.html /

USBConnectionEvent()

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.

Syntax

new USBConnectionEvent(type, USBConnectionEventInit);

Parameters

type

A string representing the name of the event. One of:

  • connect
  • disconnect
USBConnectionEventInit

An object including the following:

A USBDevice

An object representing the USB device being connected or disconnected.

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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
USBConnectionEvent
61
79
No
No
48
No
No
61
No
45
No
8.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/USBConnectionEvent/USBConnectionEvent