UNPKG

react-native-davoice-tts

Version:

tts library for React Native

53 lines (52 loc) 1.97 kB
type SpeechStartEvent = {}; type SpeechEndEvent = {}; type SpeechRecognizedEvent = { isFinal: boolean; }; type SpeechErrorEvent = { error: { code?: string; message?: string; }; }; type SpeechResultsEvent = { value: string[]; }; type SpeechVolumeChangeEvent = { value: number; }; type SpeechEvents = { onSpeechStart?: (e: SpeechStartEvent) => void; onSpeechRecognized?: (e: SpeechRecognizedEvent) => void; onSpeechEnd?: (e: SpeechEndEvent) => void; onSpeechError?: (e: SpeechErrorEvent) => void; onSpeechResults?: (e: SpeechResultsEvent) => void; onSpeechPartialResults?: (e: SpeechResultsEvent) => void; onSpeechVolumeChanged?: (e: SpeechVolumeChangeEvent) => void; }; declare class RCTSTT { private _loaded; private _listeners; private _events; constructor(); /** Remove static handlers on the native module (parity with old Voice bridge). */ removeAllListeners(): void; /** Destroy/native teardown (parity with old API). */ destroy(): Promise<void>; /** Start recognition — mirrors old `.start(locale, options?)` */ start(locale: string, options?: Record<string, any>): Promise<void>; stop(): Promise<void>; cancel(): Promise<void>; isAvailable(): Promise<0 | 1>; isRecognizing(): Promise<0 | 1>; set onSpeechStart(fn: (e: SpeechStartEvent) => void); set onSpeechRecognized(fn: (e: SpeechRecognizedEvent) => void); set onSpeechEnd(fn: (e: SpeechEndEvent) => void); set onSpeechError(fn: (e: SpeechErrorEvent) => void); set onSpeechResults(fn: (e: SpeechResultsEvent) => void); set onSpeechPartialResults(fn: (e: SpeechResultsEvent) => void); set onSpeechVolumeChanged(fn: (e: SpeechVolumeChangeEvent) => void); } export type { SpeechEndEvent, SpeechErrorEvent, SpeechEvents, SpeechStartEvent, SpeechRecognizedEvent, SpeechResultsEvent, SpeechVolumeChangeEvent, }; declare const _default: RCTSTT; export default _default;