Node Hid Singleton

This page is an extract from the repository

Sections in this article

Install the package

yarn add @ledgerhq/hw-transport-node-singleton

This package uses node-hid and usb-detection. Keep transport opened and re-use it as a singleton, one device at a time on a computer but more robust implementation.

Note
It is recommended not to use hw-transport-node-hid\* transport in the "renderer thread" but instead to spawn a dedicated thread. Otherwise the USB connection is blocking the thread and can cause performance issues

API

TransportNodeHidSingleton

Extends TransportNodeHidNoEvents

Examples

import TransportNodeHid from "@ledgerhq/hw-transport-node-hid-singleton";
...
TransportNodeHid.create().then(transport => ...)

isSupported

list

listen

Parameters

  • observer Observer<DescriptorEvent<any»

Returns Subscription

disconnect

globally disconnect the transport singleton

open

if path=”” is not provided, the library will take the first device

Returns Promise<TransportNodeHidSingleton>


Did you find this page helpful?

What would you like to see here?
Web Bluetooth
Node Speculos
Getting Started
Theme Features
Customization