MDN self-hosted library · e01.org

USB: disconnect event

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

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