microsoft / jacdac

Device and service catalogs for Jacdac.
https://aka.ms/jacdac
Creative Commons Attribution 4.0 International
66 stars 25 forks source link

Fix on JSOM Node.js example #1168

Closed alankrantas closed 2 years ago

alankrantas commented 2 years ago

[Describe the bug The createNodeUSBOptions() in JSOM Node.js requires a WebUSB constructor from the package usb ,

https://microsoft.github.io/jacdac-docs/clients/javascript/jdom/

Additional context My fix:

First the user has to install usb

npm install --save usb

Then

import { createUSBBus, createNodeUSBOptions, ... } from "jacdac-ts"
import { WebUSB } from "usb";  // fix

const options = createNodeUSBOptions(WebUSB);  // fix
const bus = createUSBBus(options);
pelikhan commented 2 years ago

Thanks! Fix applied!