diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index e3ab4eb..0000000
--- a/.babelrc
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "presets": [ "es2015", "react" ]
-}
diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644
index 05e8f09..0000000
--- a/.eslintrc
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "extends": "eslint-config-airbnb",
- "env": {
- "browser": true,
- "node": true,
- "mocha": true
- },
- "rules": {
- "no-redeclare": 0,
- "react/jsx-uses-react": 2,
- "react/jsx-uses-vars": 2,
- "react/react-in-jsx-scope": 2,
- "react/jsx-quotes": 0,
- "react/sort-comp": 0,
- "jsx-quotes": 2,
- "comma-dangle": 0,
- "indent": [2, 2, {"SwitchCase": 1}],
- "no-console": 0,
- "no-alert": 0,
- "id-length": [2, {"min": 2, "max": 50, "properties": "never", "exceptions": ["$", "i"]}]
- },
- "plugins": [
- "react"
- ],
- "globals": {
- }
-}
diff --git a/.gitignore b/.gitignore
index 30bc162..e43b0f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/node_modules
\ No newline at end of file
+.DS_Store
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..35706e6
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,3 @@
+.git
+.gitignore
+.DS_Store
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..4b5afdb
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,5 @@
+{
+ "singleQuote": true,
+ "arrowParens": "avoid",
+ "trailingComma": "none"
+}
diff --git a/LICENSE b/LICENSE
index 762cd53..eebcb0e 100755
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
-The MIT License (MIT)
+MIT License
-Copyright (c) 2014 Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff
+Copyright (c) 2025 Andrew Golightly
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index e405ce7..380425e 100644
--- a/README.md
+++ b/README.md
@@ -1,39 +1,84 @@
-# react-speech-recognition-input
-A react speech recognition component for chrome browser
+# Speech To Text
-## install
+A speech recognition module to convert speech into text.
-$ npm install react-speech-recognition-input --save
+## Install
-## Usage
+`npm install speech-to-text`
-```
-import React from 'react';
-import ReactDOM from 'react-dom';
-import Input from 'react-speech-recognition-input';
+## Typical Usage
-ReactDOM.render((
- console.log(value)} onEnd={(value) => console.log(value)} />
-), document.getElementById('chart'));
+Here is the module being used in a React component
-```
+```javascript
+import React, { useState, useEffect } from 'react';
+import SpeechToText from 'speech-to-text';
+
+const MyComponent = () => {
+ const [interimText, setInterimText] = useState('');
+ const [finalisedText, setFinalisedText] = useState([]);
+ const [listening, setListening] = useState(false);
+ const [error, setError] = useState(null);
+ const [listener, setListener] = useState(null);
+
+ useEffect(() => {
+ const onAnythingSaid = text => {
+ setInterimText(text);
+ };
-##Example
+ const onEndEvent = () => {
+ if (listening) {
+ listener?.startListening();
+ }
+ };
-*run demo*
+ const onFinalised = text => {
+ setFinalisedText(prev => [text, ...prev]);
+ setInterimText('');
+ };
+ try {
+ const speechListener = new SpeechToText(onFinalised, onEndEvent, onAnythingSaid);
+ setListener(speechListener);
+ } catch (error) {
+ setError(error.message);
+ }
+
+ // Cleanup function
+ return () => {
+ listener?.stopListening();
+ };
+ }, [listening, listener]);
+
+ // Component JSX would go here...
+}
```
-npm install
-npm start
+
+## API
+
+### The constructor
+
+- onFinalised - a callback that will be passed the finalised transcription from the cloud. Slow, but accuate.
+- onEndEvent - a callback that will be called when the end event is fired (speech recognition engine disconnects).
+- onAnythingSaid - (optional) a callback that will be passed interim transcriptions. Fairly immediate, but less accurate than finalised text.
+- language - (optional) the language to interpret against. Default is US English, and the supported languages are listed [here](https://cloud.google.com/speech-to-text/docs/languages).
+
+The constructor will throw an error if speech recognition is not supported by the browser. [Browser support](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility) includes Chrome, Edge, and Safari.
+
+```javascript
+if (!('webkitSpeechRecognition' in window)) {
+ throw new Error("This browser doesn't support speech recognition. Try Google Chrome.");
+}
```
-open [http://localhost:8080/](http://localhost:8080/)
-## props
+### startListening
+
+Initiates listening to speech input.
+
+### stopListening
-* `className`: the css class name of the wrapper.
-* `onChange`: run when you start speaking, the value is what you say.
-* `onEnd`: run when you stop speaking, the value is what you say.
+Does just that. Stops listening.
## License
-react-speech-recognition-input is released under the MIT license.
+MIT
diff --git a/example/app.js b/example/app.js
deleted file mode 100644
index d58e175..0000000
--- a/example/app.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import Input from '../src';
-
-ReactDOM.render((
-