fix
This commit is contained in:
@@ -48,6 +48,7 @@ type SpeechRecognitionHook = {
|
||||
stop: () => void
|
||||
supported: boolean
|
||||
transcript: string
|
||||
resetTranscript: () => void
|
||||
}
|
||||
|
||||
const useEventCallback = <T extends (...args: any[]) => any>(
|
||||
@@ -88,6 +89,10 @@ export const useSpeechRecognition = (
|
||||
}
|
||||
}, [])
|
||||
|
||||
const resetTranscript = () => {
|
||||
setLiveTranscript("")
|
||||
}
|
||||
|
||||
const processResult = (event: SpeechRecognitionEvent) => {
|
||||
const transcript = Array.from(event.results)
|
||||
.map((result) => result[0])
|
||||
@@ -167,6 +172,7 @@ export const useSpeechRecognition = (
|
||||
isListening: listening,
|
||||
stop,
|
||||
supported,
|
||||
transcript: liveTranscript
|
||||
transcript: liveTranscript,
|
||||
resetTranscript
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user