TypeScriptInterfaces
TypeScript Definitions
Interface definitions for JSVoice options and event objects.
JSVoiceOptions
typescript
1interface JSVoiceOptions {
2 // Recognition Settings
3 continuous?: boolean; // Default: true
4 interimResults?: boolean; // Default: true
5 lang?: string; // Default: 'en-US'
6 autoRestart?: boolean; // Default: true
7 restartDelay?: number; // Default: 500ms
8 engines?: any[]; // Default: [] (Custom engine classes)
9 engine?: any; // Default: null (Specific engine instance)
10
11 // Wake Word Settings
12 wakeWord?: string | null; // Default: null
13 wakeWordTimeout?: number; // Default: 5000ms
14
15 // Initial Commands
16 commands?: Record<string, Function>;
17 patternCommands?: Array<{pattern: string, callback: Function}>;
18
19 // Event Callbacks
20 onSpeechStart?: () => void;
21 onSpeechEnd?: () => void;
22 onCommandRecognized?: (phrase: string, raw: string, result: any, args?: any) => void;
23 onCommandNotRecognized?: (raw: string) => void;
24 onActionPerformed?: (action: string, payload: any) => void;
25 onMicrophonePermissionGranted?: () => void;
26 onMicrophonePermissionDenied?: (error: any) => void;
27 onWakeWordDetected?: (word: string) => void;
28 onError?: (error: any) => void;
29 onStatusChange?: (message: string) => void;
30}