-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(voice): allow custom voice helper (#4363)
* WIP: feat(voice): allow custom voice helper If the `createVoiceHelper` function can be overridden, other third-party voice solutions can be used, without them needing to redo all the rendering & templating. cc @dylanbfox * test: make sure creator gets called * change signature & exposed types * update tests * tsc * chore: rename internal functions * accept arbitrary state * Revert "accept arbitrary state" This reverts commit 4f40e97. Co-authored-by: eunjae-lee <[email protected]> Co-authored-by: Dustin Coates <[email protected]>
- Loading branch information
1 parent
547f6aa
commit 4a00fa6
Showing
8 changed files
with
131 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export type Status = | ||
| 'initial' | ||
| 'askingPermission' | ||
| 'waiting' | ||
| 'recognizing' | ||
| 'finished' | ||
| 'error'; | ||
|
||
export type VoiceListeningState = { | ||
status: Status; | ||
transcript: string; | ||
isSpeechFinal: boolean; | ||
errorCode?: string; | ||
}; | ||
|
||
export type VoiceSearchHelperParams = { | ||
searchAsYouSpeak: boolean; | ||
language?: string; | ||
onQueryChange: (query: string) => void; | ||
onStateChange: () => void; | ||
}; | ||
|
||
export type VoiceSearchHelper = { | ||
getState: () => VoiceListeningState; | ||
isBrowserSupported: () => boolean; | ||
isListening: () => boolean; | ||
startListening: () => void; | ||
stopListening: () => void; | ||
dispose: () => void; | ||
}; | ||
|
||
export type CreateVoiceSearchHelper = ( | ||
params: VoiceSearchHelperParams | ||
) => VoiceSearchHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters