@revrag-ai/embed-react-native
Version:
A powerful React Native library for integrating AI-powered voice agents into mobile applications. Features real-time voice communication, intelligent speech processing, customizable UI components, and comprehensive event handling for building conversation
41 lines • 1.5 kB
TypeScript
/**
* Agent Event Emitter
* Handles listening to agent state changes (connection, disconnection, popup visibility)
* Also sends agent events to the backend API
*/
import type { EventCallback, AgentEvent } from './embed.types';
export declare class AgentEventEmitter {
private agentListeners;
/**
* Add an event listener for agent events
* @param eventKey - The agent event to listen for
* @param callback - Callback function to execute when event fires
*/
on(eventKey: AgentEvent, callback: EventCallback): void;
/**
* Remove an event listener for agent events
* @param eventKey - The agent event to stop listening to
* @param callback - The callback function to remove
*/
off(eventKey: AgentEvent, callback: EventCallback): void;
/**
* Emit an agent event to all registered listeners AND send to backend
* @param eventKey - The agent event to emit
* @param data - Data to pass to listeners
* @internal - Used internally by the library
*/
emit(eventKey: AgentEvent, data: any): Promise<void>;
/**
* Send agent event data to backend API
* @param eventKey - The agent event type
* @param data - Event data
* @private
*/
private sendToBackend;
/**
* Remove all listeners for a specific event
* @param eventKey - The agent event to clear listeners for
*/
removeAllListeners(eventKey?: AgentEvent): void;
}
//# sourceMappingURL=agent-event-emitter.d.ts.map