Skip to content

Commit e0742e3

Browse files
authored
fix(kokoro): register streamStop on JSI host object (#951)
## Summary `Kokoro::streamStop()` exists in C++ (`Kokoro.cpp:205`) and is called from the JS `TextToSpeechModule.streamStop()` via `this.nativeModule.streamStop()`, but it's never registered on the JSI host object in `ModelHostObject.h`. This causes a runtime error when stopping TTS streaming: ``` TypeError: this.nativeModule.streamStop is not a function (it is undefined) ``` The fix registers `streamStop` as a `synchronousHostFunction` in the Kokoro `if constexpr` block, matching the existing pattern used for `SpeechToText`. ## Changes - `ModelHostObject.h`: Add `streamStop` JSI registration for Kokoro model type
1 parent a3f0cf9 commit e0742e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ template <typename Model> class ModelHostObject : public JsiHostObject {
171171
addFunctions(JSI_EXPORT_FUNCTION(ModelHostObject<Model>,
172172
promiseHostFunction<&Model::stream>,
173173
"stream"));
174+
addFunctions(JSI_EXPORT_FUNCTION(
175+
ModelHostObject<Model>,
176+
synchronousHostFunction<&Model::streamStop>,
177+
"streamStop"));
174178
addFunctions(JSI_EXPORT_FUNCTION(
175179
ModelHostObject<Model>,
176180
promiseHostFunction<&Model::generateFromPhonemes>,

0 commit comments

Comments
 (0)