TalAter / annyang

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

fixed SpeechRecognition of undefined #453

Closed WebRitual closed 2 years ago

WebRitual commented 2 years 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 2 years 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 🙏