UNPKG

xkeys-webhid

Version:

An npm module for interfacing with the X-keys panels in a browser

30 lines 1.32 kB
/// <reference types="w3c-web-hid" /> /** * This class is used to register listener for connect and disconnect events for HID devices. * It allows for a few clever tricks, such as * * listenForDisconnectOnce() listens for a disconnect event for a specific device, and then removes the listener. * * handles a special case where the 'connect' event isn't fired when adding permissions for a HID device. */ export declare class GlobalConnectListener { private static anyConnectListeners; private static anyDisconnectListeners; private static disconnectListenersOnce; private static isSetup; /** Add listener for any connect event */ static listenForAnyConnect(callback: () => void): { stop: () => void; }; /** Add listener for any disconnect event */ static listenForAnyDisconnect(callback: () => void): { stop: () => void; }; /** Add listener for disconnect event, for a HIDDevice. The callback will be fired once. */ static listenForDisconnectOnce(device: HIDDevice, callback: () => void): void; static notifyConnectedDevice(): void; private static setup; private static handleDisconnect; private static handleConnect; private static maybeTeardown; private static teardown; } //# sourceMappingURL=globalConnectListener.d.ts.map