UNPKG

gan-i3-356-bluetooth

Version:

Library for connecting to and interacting with Bluetooth-enabled Rubik's cubes (GAN)

42 lines 1.58 kB
/** * Type definition for event handlers */ export type EventHandler<T> = (data: T) => void; /** * Simple event emitter class for handling custom events with typed events and payloads * * @template TEventMap - A record mapping event names to their payload types */ export declare class EventEmitter<TEventMap extends Record<string, any> = Record<string, any>> { private events; private readonly instanceId; constructor(); /** * Register an event listener with type-safe event name and payload * @param event - Event name (must be a key of TEventMap) * @param callback - Callback function with properly typed payload */ on<K extends keyof TEventMap & string>(event: K, callback: EventHandler<TEventMap[K]>): void; /** * Remove an event listener * @param event - Event name (must be a key of TEventMap) * @param callback - Callback function to remove */ off<K extends keyof TEventMap & string>(event: K, callback: EventHandler<TEventMap[K]>): void; /** * Emit an event with properly typed data * @param event - Event name (must be a key of TEventMap) * @param data - Event data (must match the type defined for this event) */ emit<K extends keyof TEventMap & string>(event: K, data: TEventMap[K]): void; /** * Remove all event listeners */ clearAllListeners(): void; /** * Get the instance ID for debugging */ getInstanceId(): string; } export declare function matchUUID(uuid1: string, uuid2: string): boolean; //# sourceMappingURL=utils.d.ts.map