@designcrowd/fe-shared-lib 1.8.7 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/useVoiceToText.ts +6 -1
package/package.json
CHANGED
package/src/useVoiceToText.ts
CHANGED
|
@@ -104,6 +104,8 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
isListening.value = false;
|
|
108
|
+
|
|
107
109
|
const message = ERROR_MESSAGES[event.error] || 'An error occurred with speech recognition.';
|
|
108
110
|
error.value = message;
|
|
109
111
|
|
|
@@ -118,6 +120,10 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
118
120
|
}, ERROR_CLEAR_DELAY);
|
|
119
121
|
};
|
|
120
122
|
|
|
123
|
+
recognition.onstart = () => {
|
|
124
|
+
isListening.value = true;
|
|
125
|
+
};
|
|
126
|
+
|
|
121
127
|
recognition.onend = () => {
|
|
122
128
|
isListening.value = false;
|
|
123
129
|
};
|
|
@@ -142,7 +148,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
142
148
|
|
|
143
149
|
try {
|
|
144
150
|
recognition.start();
|
|
145
|
-
isListening.value = true;
|
|
146
151
|
} catch (e: unknown) {
|
|
147
152
|
// eslint-disable-next-line no-console
|
|
148
153
|
console.warn('[useVoiceToText] Failed to start:', (e as Error).message);
|