Firefox Tomorrow

web api interface

USBConnectionEvent

View on MDN ↗

Limited availabilitySecure contextAvailable in workers

The USBConnectionEvent interface of the WebUSB API is the event type passed to USB connect and disconnect events when the user agent detects that a new USB device has been connected or disconnected.

Constructor

Instance properties

  • device Read only Experimental
    • : Returns a USBDevice object representing the current device.

Examples

In the following example listening for connect and disconnect events is used to add and remove the devices from the user interface of an application.

navigator.usb.addEventListener("connect", (event) => {
  // Add event.device to the UI.
});

navigator.usb.addEventListener("disconnect", (event) => {
  // Remove event.device from the UI.
});

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.