How to use the usb.removeListener function in usb

To help you get started, we’ve selected a few usb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LedgerHQ / ledgerjs / packages / hw-transport-node-hid / src / listenDevices.js View on Github external
stop: () => {
      log(
        "hid-listen",
        "Stop received, removing listeners and cancelling pending debounced polls"
      );
      debouncedPoll.cancel();
      usb.removeListener("attach", attachDetected);
      usb.removeListener("detach", detachDetected);
    },
    events
github thegecko / webusb / src / adapter.ts View on Github external
this.on("removeListener", event => {
            const listenerCount = this.listenerCount(event);

            if (listenerCount !== 0) {
                return;
            }

            if (event === USBAdapter.EVENT_DEVICE_CONNECT) {
                removeListener("attach", attachCallback);
            } else if (event === USBAdapter.EVENT_DEVICE_DISCONNECT) {
                removeListener("detach", detachCallback);
            }
        });
    }
github LedgerHQ / ledgerjs / packages / hw-transport-node-hid / src / listenDevices.js View on Github external
stop: () => {
      log(
        "hid-listen",
        "Stop received, removing listeners and cancelling pending debounced polls"
      );
      debouncedPoll.cancel();
      usb.removeListener("attach", attachDetected);
      usb.removeListener("detach", detachDetected);
    },
    events
github thegecko / webusb / src / adapter.ts View on Github external
this.on("removeListener", event => {
            const listenerCount = this.listenerCount(event);

            if (listenerCount !== 0) {
                return;
            }

            if (event === USBAdapter.EVENT_DEVICE_CONNECT) {
                removeListener("attach", attachCallback);
            } else if (event === USBAdapter.EVENT_DEVICE_DISCONNECT) {
                removeListener("detach", detachCallback);
            }
        });
    }