Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* node-hid Transport implementation
* @example
* import TransportNodeHid from "@ledgerhq/hw-transport-node-hid-singleton";
* ...
* TransportNodeHid.create().then(transport => ...)
*/
export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents {
/**
*
*/
static isSupported = TransportNodeHidNoEvents.isSupported;
/**
*
*/
static list = TransportNodeHidNoEvents.list;
/**
*/
static listen = (observer: Observer>): Subscription => {
let unsubscribed;
Promise.resolve(getDevices()).then(devices => {
// this needs to run asynchronously so the subscription is defined during this phase
for (const device of devices) {
if (!unsubscribed) {
const deviceModel = identifyUSBProductId(device.productId);
observer.next({
type: "add",
descriptor: "",
device: { name: device.deviceName },
deviceModel
});
* node-hid Transport implementation
* @example
* import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
* ...
* TransportNodeHid.create().then(transport => ...)
*/
export default class TransportNodeHid extends TransportNodeHidNoEvents {
/**
*
*/
static isSupported = TransportNodeHidNoEvents.isSupported;
/**
*
*/
static list = TransportNodeHidNoEvents.list;
/**
*
*/
static setListenDevicesDebounce = (delay: number) => {
listenDevicesDebounce = delay;
};
/**
*
*/
static setListenDevicesPollingSkip = (conditionToSkip: () => boolean) => {
listenDevicesPollingSkip = conditionToSkip;
};
/**