SpeechToText js simplify the onChange event code

This commit is contained in:
Matt Flax 2025-05-11 19:56:46 +10:00
parent 641dc51699
commit edb51373b2

View file

@ -58,17 +58,11 @@
// Append to the existing value // Append to the existing value
chatInput.value = chatInput.value + ' ' + text; chatInput.value = chatInput.value + ' ' + text;
// Create a synthetic event that React's onChange will accept // Create a simplified synthetic event with only essential properties
const syntheticEvent = { const syntheticEvent = {
target: chatInput, target: chatInput,
currentTarget: chatInput, currentTarget: chatInput,
preventDefault: () => {}, preventDefault: () => {},
stopPropagation: () => {},
persist: () => {},
isDefaultPrevented: () => false,
isPropagationStopped: () => false,
bubbles: true,
cancelable: true,
nativeEvent: new Event('input', { bubbles: true }) nativeEvent: new Event('input', { bubbles: true })
}; };