UNPKG

920 BPlain TextView Raw
1export type SpeechEventCallback = (this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any;
2
3export type SpeechOptions = {
4 language?: string;
5 pitch?: number;
6 rate?: number;
7 onStart?: () => void | SpeechEventCallback;
8 onStopped?: () => void | SpeechEventCallback;
9 onDone?: () => void | SpeechEventCallback;
10 onError?: (error: Error) => void | SpeechEventCallback;
11
12 volume?: number;
13 voice?: string;
14 _voiceIndex?: number;
15 onBoundary?: SpeechEventCallback | null;
16 onMark?: SpeechEventCallback | null;
17 onPause?: SpeechEventCallback | null;
18 onResume?: SpeechEventCallback | null;
19};
20
21export enum VoiceQuality {
22 Default = 'Default',
23 Enhanced = 'Enhanced',
24}
25
26export type Voice = {
27 identifier: string;
28 name: string;
29 quality: VoiceQuality;
30 language: string;
31};
32
33export type WebVoice = Voice & {
34 isDefault: boolean;
35 localService: boolean;
36 name: string;
37 voiceURI: string;
38};