UsbDetector

physical. UsbDetector

A wrapper for the "usb-detection" module. It balances the number of calls to stopMonitoring to the previous number of calls to startMonitoring. See usb-detection.

Constructor

new UsbDetector(usbDetect)

Source:
Parameters:
Name Type Description
usbDetect

The "usb-detection" module.

Methods

on(eventName, callback)

Description:
Source:
Parameters:
Name Type Description
eventName string

Event name.

callback function

Event callback.

startMonitoring()

Description:
  • Starts listening to USB events. Can be called multiple times. Will prevent the process from exiting until stopMonitoring is called a matching number of times.

Source:

stopMonitoring()

Description:
  • Stops listening to USB events, and allows the process to exit, but ONLY at the last call of a matching chain of startMonitoring calls.

Source:

supportsMonitoring() → {boolean}

Description:
  • Whether this detector supports monitoring: if the detector detects.

Source:
Returns:

If the detector supports monitoring - always true.

Type
boolean