thegecko/webusb

Can this api be used to detect USB plug/unplug?

samhuang1111 opened this issue · 1 comments

Can this api be used to detect USB plug/unplug?

Yes, it follows the WebUSB spec which outlines onconnect and ondisconnect` events:

usb.onconnect = deviceConnected;

However, if you just want to detect usb devices in node and don't need it to look like WebUSB, I'd recommend using the node-usb or usb-detection libraries.