/
index.d.ts
94 lines (83 loc) 路 2.66 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
type Status =
| { status: "created" }
| {
status: "init: complete";
initialized: boolean;
speechSynthesis: SpeechSynthesis;
speechSynthesisUtterance: SpeechSynthesisUtterance;
speechSynthesisVoice: SpeechSynthesisVoice;
speechSynthesisEvent: SpeechSynthesisEvent;
speechSynthesisErrorEvent: SpeechSynthesisErrorEvent;
voices: SpeechSynthesisVoice[];
defaults: {
pitch: number;
rate: number;
volume: number;
voice: SpeechSynthesisVoice | null;
};
handlers: any;
};
export default class EasySpeech {
public static init(request: {
maxTimeout: number;
interval: number;
quiet?: boolean;
}): Promise<boolean>;
public static detect(): {
speechSynthesis: SpeechSynthesis | undefined;
speechSynthesisUtterance: SpeechSynthesisUtterance | undefined;
speechSynthesisVoice: SpeechSynthesisVoice | undefined;
speechSynthesisEvent: SpeechSynthesisEvent | undefined;
speechSynthesisErrorEvent: SpeechSynthesisErrorEvent | undefined;
onvoiceschanged: boolean;
onboundary: boolean;
onend: boolean;
onerror: boolean;
onmark: boolean;
onpause: boolean;
onresume: boolean;
onstart: boolean;
};
public static status(): Status;
public static voices(): SpeechSynthesisVoice[];
public static on(handlers: {
boundary?: (event: SpeechSynthesisEvent) => void;
end?: (event: SpeechSynthesisEvent) => void;
mark?: (event: SpeechSynthesisEvent) => void;
pause?: (event: SpeechSynthesisEvent) => void;
resume?: (event: SpeechSynthesisEvent) => void;
start?: (event: SpeechSynthesisEvent) => void;
error?: (event: SpeechSynthesisErrorEvent) => void;
}): SpeechSynthesisVoice[];
public static defaults(options: {
voice?: SpeechSynthesisVoice;
pitch?: number;
rate?: number;
volume?: number;
}): {
pitch: Number;
rate: Number;
volume: Number;
voice: null | SpeechSynthesisVoice;
};
public static speak(options: {
text: string;
voice?: SpeechSynthesisVoice;
pitch?: number;
rate?: number;
volume?: number;
force?: boolean;
infiniteResume?: boolean;
boundary?: (event: SpeechSynthesisEvent) => void;
end?: (event: SpeechSynthesisEvent) => void;
mark?: (event: SpeechSynthesisEvent) => void;
pause?: (event: SpeechSynthesisEvent) => void;
resume?: (event: SpeechSynthesisEvent) => void;
start?: (event: SpeechSynthesisEvent) => void;
error?: (event: SpeechSynthesisErrorEvent) => void;
}): Promise<any>;
public static cancel(): void;
public static resume(): void;
public static pause(): void;
public static reset(): void;
}