Skip to content

Commit

Permalink
throw
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed Mar 8, 2025
1 parent d0a99b3 commit 5d6f66c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/usblib.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export class usbClass {
*/
async connect(device = undefined) {
if (!device) {
if (!("usb" in navigator)) {
throw "USB - WebUSB not supported";
}
device = await navigator.usb.requestDevice({ filters: [USB_FILTER] });
console.debug("[usblib] Using USB device:", device);
}
Expand Down

0 comments on commit 5d6f66c

Please sign in to comment.