Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { listenDevices } from "./listenDevices";
let transportInstance;
/**
* 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({
let listenDevicesDebounce = 500;
let listenDevicesPollingSkip = () => false;
/**
* 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;
};
/**
*
*/