Skip to content

Commit

Permalink
🐛 fix: the isLoading property of the useSpeechSynthes hook (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: yang.qian7 <[email protected]>
  • Loading branch information
dayuy and yang.qian7 authored Nov 22, 2024
1 parent 8bc43f2 commit bb0473a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/react/useSpeechSynthes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const useSpeechSynthes = (
if (!SpeechSynthesisUtterance) return;
const utterance = new SpeechSynthesisUtterance(text);
utterance.voice = voiceList.find((item: any) => item.name === voice) as any;
utterance.onstart = () => setIsLoading(true);
utterance.onend = () => setIsLoading(false);
if (pitch) utterance.pitch = pitch * 10;
if (rate) utterance.rate = rate * 10;
return utterance;
Expand Down

0 comments on commit bb0473a

Please sign in to comment.