import { NitroModules } from 'react-native-nitro-modules' import type { EventName, TextToSpeechOptions, TextToSpeech as TextToSpeechSpec, TextToSpeechVoice } from './specs/text-to-speech.nitro' export const TextToSpeechNitroModule = NitroModules.createHybridObject('TextToSpeech') export const TextToSpeech = { speak: async (text: string, options?: TextToSpeechOptions): Promise => { return TextToSpeechNitroModule.speak(text, options) }, stop: async (): Promise => { return TextToSpeechNitroModule.stop() }, pause: async (): Promise => { return TextToSpeechNitroModule.pause() }, resume: async (): Promise => { return TextToSpeechNitroModule.resume() }, getVoices: async (): Promise => { return TextToSpeechNitroModule.getVoices() }, addEventListener: (event: EventName, listener: (word?: string) => void): (() => void) => { return TextToSpeechNitroModule.addEventListener(event, listener) }, }