UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

79 lines (78 loc) 2.12 kB
/// <reference types="dom-speech-recognition" /> /** * Speech to text class * uses webkitSpeechRecognition */ export declare class SpeechToText { query: string | null; recognition?: SpeechRecognition; listening: boolean; error?: SpeechRecognitionErrorEvent | Error; initialized: boolean; constructor(); /** * initialize the speech recognition * @param continuous - if true, the speech recognition will continue listening after each recognition */ init: (continuous: boolean) => void; /** * Sets query - the last result from the speech recognition * @param query - the query to set */ setQuery: (query: string | null) => void; /** * Upgrade the speech recognition */ upgrade: () => void; /** * * @param event - the speech recognition event */ onResult: (event: SpeechRecognitionEvent) => void; /** * Start the speech recognition */ start: () => void; /** * Stop the speech recognition */ stop: () => void; /** * mark speech recognition as initialized * @param initialized - set the initialized state */ setInitialized: (initialized: boolean) => void; /** * Sets the listening state * @param listening - set the listening state */ setListening: (listening: boolean) => void; /** * * @param error - set the error */ setError: (error: SpeechRecognitionErrorEvent | Error) => void; /** * Called when the speech recognition starts */ onstart: () => void; /** * Called when the speech recognition ends */ onend: () => void; /** * Called when the speech recognition errors * @param error - the error */ onerror: (error: SpeechRecognitionErrorEvent) => void; /** * Cancel the speech recognition */ cancel: () => void; /** * Restart the speech recognition * @param continuous - if true, the speech recognition will continue * listening after each recognition */ restart: (continuous?: boolean) => void; }