UNPKG

@freddydrodev/artyom

Version:

Artyom is a Robust Wrapper of the Google Chrome SpeechSynthesis and SpeechRecognition that allows you to create a virtual assistent

110 lines (97 loc) 2.39 kB
export interface ArtyomCommand { indexes: string[]; action: (index: number, wildcard?: any, full?: string) => void; description?: string; smart?: boolean; } export interface ArtyomFlags { restartRecognition: boolean; } export interface ArtyomVoice { voiceURI: string; name: string; lang: string; localService: boolean; default: boolean; } export interface ArtyomGlobalEvents { ERROR: string; SPEECH_SYNTHESIS_START: string; SPEECH_SYNTHESIS_END: string; TEXT_RECOGNIZED: string; COMMAND_RECOGNITION_START: string; COMMAND_RECOGNITION_END: string; COMMAND_MATCHED: string; NOT_COMMAND_MATCHED: string; } export interface SayCallbacksObject { lang?: string; onStart?: () => void; onEnd?: () => void; } export interface ArtyomProperties { lang: string; recognizing: boolean; continuous: boolean; speed: number; volume: number; listen: boolean; mode: "command" | "dictation" | "normal"; debug: boolean; helpers: { fatalityPromiseCallback?: () => void; redirectRecognizedTextOutput?: (text: string, isFinal: boolean) => void; remoteProcessorHandler?: (text: string) => void; lastSay?: { text: string; date: Date }; }; executionKeyword?: string; obeyKeyword?: string; speaking: boolean; obeying: boolean; soundex: boolean; name?: string; voice?: SpeechSynthesisVoice | null; } export interface PromptOptions { question: string; options: string[]; beforePrompt?: () => void; onStartPrompt?: () => void; onEndPrompt?: () => void; onMatch?: (index: number, wildcard: string) => () => void; smart?: boolean; } export interface MatchedCommand { index: number; instruction: ArtyomCommand; wildcard?: { item: string; full: string; }; } export interface IDevice { isChrome: boolean; isMobile: boolean; } export interface ArtyomVoiceIdentifiers { [key: string]: string[]; } export interface ArtyomGarbageCollection { [key: string]: any; } export interface ArtyomWebkitSpeechRecognition { continuous: boolean; interimResults: boolean; lang: string; start: () => void; stop: () => void; abort: () => void; onresult: (event: SpeechRecognitionEvent) => void; onerror: (event: SpeechRecognitionErrorEvent) => void; onend: () => void; } declare global { interface Window { webkitSpeechRecognition: new () => ArtyomWebkitSpeechRecognition; } }