anteloe / speech-polyfill

This is a Polyfill for the HTML5 Speech Recognition API. It uses Microsoft's Cognitive Services as a backend. All Browsers supporting WebRTC will be supported by this Polyfill.
MIT License
21 stars 5 forks source link

event is not defined #5

Closed avaer closed 5 years ago

avaer commented 5 years ago

This is throwing in the recognition loop for me at the end of a phrase:

https://github.com/anteloe/speech-polyfill/blob/845942751caedbcd7a5b364f58efd912d754c423/js/src/SpeechRecognition.js#L129

ReferenceError: event is not defined
    at SpeechRecognition.handleResult (speech-polyfill.js:2075:51)
    at SpeechRecognition.handleEvent (speech-polyfill.js:2022:29)
    at RequestSession.OnEvent (speech-polyfill.js:3202:22)
    at RequestSession.OnServiceDetailedSpeechPhraseResponse (speech-polyfill.js:3161:18)
    at connection.Read.OnSuccessContinueWithPromise (speech-polyfill.js:3010:48)
    at sink.on (speech-polyfill.js:1164:49)
    at Sink.ExecuteSuccessCallback (speech-polyfill.js:1281:17)
    at Sink.Resolve (speech-polyfill.js:1245:22)
    at Deferred.Resolve (speech-polyfill.js:1217:23)
    at Object.Queue.Drain (speech-polyfill.js:1436:45)
avaer commented 5 years ago

I think the destructuring in that function should be event.

avaer commented 5 years ago

The code might be referring to the global window.event, in which case this PR isn't needed.