mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
chore(frontend): drop the new JSDoc from the TTS playback helpers
The repository keeps code self-documenting, and the helper names and the voice flow call sites already describe what unlock primes.
This commit is contained in:
1 parent
22ee356c10
commit
d089dde466
2 files changed
-20
No files matched your search
@@ -31,24 +31,11 @@ interface SpeechRequest {
|
||||
onEnd?: (reason: TTSEndReason, error?: string) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a rejection is the browser refusing playback outside a user gesture.
|
||||
*
|
||||
* @param error The rejection value from play().
|
||||
* @returns True for a NotAllowedError.
|
||||
*/
|
||||
function isNotAllowedError(error: unknown): boolean {
|
||||
if (typeof error !== 'object' || error === null) return false
|
||||
return (error as { name?: unknown }).name === 'NotAllowedError'
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks the message shown for a failed playback.
|
||||
*
|
||||
* @param error The rejection value from play().
|
||||
* @param fallback The message to use when the rejection carries none.
|
||||
* @returns The message to surface to the user.
|
||||
*/
|
||||
function playbackErrorMessage(error: unknown, fallback: string): string {
|
||||
if (isNotAllowedError(error)) return PLAYBACK_BLOCKED_MESSAGE
|
||||
return error instanceof Error && error.message ? error.message : fallback
|
||||
|
||||
@@ -23,13 +23,6 @@ export interface TTSContextValue {
|
||||
speakWithConfig: (text: string, config: TTSConfig) => Promise<boolean>
|
||||
speakMessage: (messageId: string, text: string, options?: SpeakMessageOptions) => Promise<boolean>
|
||||
queueMessage: (messageId: string, text: string) => void
|
||||
/**
|
||||
* Primes the shared audio element inside a user gesture so a reply that
|
||||
* arrives later is allowed to start playing. Must be called synchronously from
|
||||
* the gesture handler. Does nothing while audio is already in use or once the
|
||||
* element is primed, and does nothing for the builtin Web Speech provider,
|
||||
* which keeps its own gesture requirement.
|
||||
*/
|
||||
unlock: () => void
|
||||
stop: () => void
|
||||
pause: () => void
|
||||
|
||||
Reference in new issue
Block a user