-
-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Introduction
The react-speech-recognition library currently provides polyfill support for several speech recognition services such as Microsoft Azure Cognitive Services. With the emergence of remarkably accurate and performant speech-to-text (STT) services like ElevenLabs' Scribe, this RFC proposes removing all polyfill support to minimise the package and refocus its purpose.
Proposed Changes
This RFC proposes modifying react-speech-recognition to:
- Remove all polyfill support completely
- Focus solely on providing React hooks and components that handle the Web Speech API lifecycle
Reason
The primary value of react-speech-recognition is not in providing alternatives to the Web Speech API, but rather in its management of:
- Recognition lifecycle within React components
- Proper cleanup when components unmount
- State management for recognition results
- Browser compatibility detection
By focusing exclusively on these aspects, the library can reduce its footprint, simplify maintenance, and provide a clearer API.
Implementation Details
The implementation would involve:
- Removing all polyfill-related code and dependencies
- Simplifying the API to focus on Web Speech API integration
- Updating documentation to reflect the new focus
Advantages
- Smaller package size: Significantly reduced bundle size without polyfill code
- Simplified maintenance: Focus on one API rather than multiple services
- Clearer responsibility boundaries: Specialise in React integration with Web Speech API
- Flexibility for developers: Freedom to choose and integrate preferred STT services
- Future-proofing: Independence from needing updates for new STT services
Potential Concerns
- Breaking changes: Existing implementations using polyfills would need updating
- Learning curve: Developers would need to learn third-party service integration 3. Fragmentation: Different projects might implement integrations differently
Conclusion
By focusing exclusively on providing an excellent React wrapper for the Web Speech API, react-speech-recognition can become a more maintainable, leaner library that does one thing exceptionally well. This approach aligns with the React community's preference for smaller, focused libraries over larger all-in-one solutions.