TalAter / annyang

:speech_balloon: Speech recognition for your site
https://www.talater.com/annyang/
MIT License
6.57k stars 1.05k forks source link

fixed SpeechRecognition of undefined #453

Closed WebRitual closed 1 year ago

WebRitual commented 1 year ago

Description

fixed SpeechRecognition of undefined

Motivation and Context

import annyang from "annyang"; And I get "Cannot read property 'SpeechRecognition' of undefined"

How Has This Been Tested?

localy

Types of changes

Checklist:

TalAter commented 1 year ago

Hi @WebRitual ,

Thank you for the contribution and for taking the time to send in the pull request.

Unfortunately the code as submitted will break in browsers that do not support the SpeechRecognition API. It will also be a breaking change in what the library returns on initialization and will thus require a major version release (a 3.0.0 release). My concern is that even if we release a major version intended to support an import use case, the rest of the library wasn't designed to be imported that way as it was written quite some time ago. I think if we were to do a major version release like this it should entail a rewrite of the library to support importing it into modern codebases.

Any thoughts?

Thank you 🙏