JM_KA/assets/Script/Text_to_Speech.ts
2022-01-21 11:01:58 +08:00

28 lines
684 B
TypeScript

export default class Text_to_Speech {
//#region 外調參數
private _responsiveVoice: any = window["responsiveVoice"];
//#endregion
//#region Custom
constructor() {
this._responsiveVoice.speak("hello world");
}
public speak(msg: string): void {
let self: this = this;
this._responsiveVoice.speak(msg, "Chinese Female", {
onstart: function (Callback: any): void {
console.log(`onstart msg: ${msg}`);
},
onend: function (Callback: any): void {
console.log(`onstart msg: ${msg}`);
},
});
}
//#endregion
}