UNPKG

shuttle-node

Version:

An npm module for interfacing with the Contour Shuttle devices in Node.js

43 lines 1.75 kB
import { EventEmitter } from 'eventemitter3'; import { Shuttle } from '@shuttle-lib/core'; export interface ShuttleWatcherEvents { connected: [shuttle: Shuttle]; error: [err: any]; } /** * Set up a watcher for newly connected Shuttle devices. * Note: It is highly recommended to set up a listener for the disconnected event on the Shuttle device, to clean up after a disconnected device. */ export declare class ShuttleWatcher extends EventEmitter<ShuttleWatcherEvents> { private options?; private seenDevicePaths; private isMonitoring; private updateConnectedDevicesTimeout; private updateConnectedDevicesIsRunning; private updateConnectedDevicesRunAgain; private shouldFindChangedReTries; debug: boolean; /** A list of the devices we've called setupShuttles for */ private setupDevices; private pollingInterval; constructor(options?: ShuttleWatcherOptions | undefined); /** * Stop the watcher * @param closeAllDevices Set to false in order to NOT close all devices. Use this if you only want to stop the watching. Defaults to true */ stop(closeAllDevices?: boolean): Promise<void>; private onAddedUSBDevice; private onRemovedUSBDevice; private triggerUpdateConnectedDevices; private updateConnectedDevices; private handleNewDevice; private handleRemovedDevice; private debugLog; } export interface ShuttleWatcherOptions { /** If set, will use polling for devices instead of watching for them directly. Might be a bit slower, but is more compatible. */ usePolling?: boolean; /** If usePolling is set, the interval to use for checking for new devices. */ pollingInterval?: number; } //# sourceMappingURL=watcher.d.ts.map