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)

Source:

Register a callback to an USB event. See usbDetect#on.

Parameters:
Name Type Description
eventName string

Event name.

callback function

Event callback.

startMonitoring()

Source:

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.

stopMonitoring()

Source:

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

supportsMonitoring() → {boolean}

Source:

Whether this detector supports monitoring: if the detector detects.

Returns:

If the detector supports monitoring - always true.

Type
boolean