Skip to content

Commit bceee7d

Browse files
committed
Implement feedback: Remove unnecessary try-catch, adjust async handling for speech recognition
1 parent 75471d0 commit bceee7d

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

README.md

+14-19
Original file line numberDiff line numberDiff line change
@@ -104,26 +104,21 @@ function App() {
104104
});
105105

106106
const handleStart = async () => {
107-
try {
108-
const result =
109-
await ExpoSpeechRecognitionModule.requestPermissionsAsync();
110-
if (!result.granted) {
111-
console.warn("Permissions not granted", result);
112-
return;
113-
}
114-
// Start speech recognition
115-
await ExpoSpeechRecognitionModule.start({
116-
lang: "en-US",
117-
interimResults: true,
118-
maxAlternatives: 1,
119-
continuous: false,
120-
requiresOnDeviceRecognition: false,
121-
addsPunctuation: false,
122-
contextualStrings: ["Carlsen", "Nepomniachtchi", "Praggnanandhaa"],
123-
});
124-
} catch (error) {
125-
console.error("Error starting speech recognition:", error);
107+
const result = await ExpoSpeechRecognitionModule.requestPermissionsAsync();
108+
if (!result.granted) {
109+
console.warn("Permissions not granted", result);
110+
return;
126111
}
112+
// Start speech recognition
113+
ExpoSpeechRecognitionModule.start({
114+
lang: "en-US",
115+
interimResults: true,
116+
maxAlternatives: 1,
117+
continuous: false,
118+
requiresOnDeviceRecognition: false,
119+
addsPunctuation: false,
120+
contextualStrings: ["Carlsen", "Nepomniachtchi", "Praggnanandhaa"],
121+
});
127122
};
128123

129124
return (

0 commit comments

Comments
 (0)