UNPKG

ive-connect

Version:

A universal haptic device control library for interactive experiences

33 lines (32 loc) 927 B
/** * Simple event system for device communication */ type EventCallback = (data: any) => void; export declare class EventEmitter { private events; /** * Register an event listener * @param event Event name * @param callback Function to call when event is emitted * @returns Unsubscribe function */ on(event: string, callback: EventCallback): () => void; /** * Remove an event listener * @param event Event name * @param callback Function to remove */ off(event: string, callback: EventCallback): void; /** * Emit an event with data * @param event Event name * @param data Data to pass to listeners */ emit(event: string, data?: any): void; /** * Remove all event listeners * @param event Optional event name. If not provided, all events are cleared. */ removeAllListeners(event?: string): void; } export {};