aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DictationManager.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-07-31 03:21:59 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-07-31 03:21:59 -0400
commit8a87f7110b56ca96b3960f6fb3917c7ed8c7a814 (patch)
treede47681ad0ce1e87de6321216bfb20337512a837 /src/client/util/DictationManager.ts
parent31a8bb32e696d58816329b66cfc5b92907494d1b (diff)
overlay completed
Diffstat (limited to 'src/client/util/DictationManager.ts')
-rw-r--r--src/client/util/DictationManager.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/client/util/DictationManager.ts b/src/client/util/DictationManager.ts
index 6d67f6d6d..80efe12cd 100644
--- a/src/client/util/DictationManager.ts
+++ b/src/client/util/DictationManager.ts
@@ -1,5 +1,5 @@
import { string } from "prop-types";
-import { observable, action } from "mobx";
+import { observable, action, autorun } from "mobx";
import { SelectionManager } from "./SelectionManager";
import { DocumentView } from "../views/nodes/DocumentView";
import { UndoManager } from "./UndoManager";
@@ -8,6 +8,7 @@ import { Doc } from "../../new_fields/Doc";
import { List } from "../../new_fields/List";
import { Docs } from "../documents/Documents";
import { CollectionViewType } from "../views/collections/CollectionBaseView";
+import { MainView } from "../views/MainView";
namespace CORE {
export interface IWindow extends Window {
@@ -22,8 +23,8 @@ export type RegexEntry = { key: RegExp, value: DependentAction };
export default class DictationManager {
public static Instance = new DictationManager();
- private isListening = false;
private recognizer: any;
+ private isListening = false;
constructor() {
this.recognizer = new webkitSpeechRecognition();
@@ -31,18 +32,14 @@ export default class DictationManager {
this.recognizer.continuous = true;
}
- @observable public current = "";
-
- @action
finish = (handler: any, data: any) => {
- this.current = data;
handler(data);
this.stop();
}
stop = () => {
- this.isListening = false;
this.recognizer.stop();
+ this.isListening = false;
}
listen = () => {
@@ -55,7 +52,6 @@ export default class DictationManager {
this.recognizer.onresult = (e: any) => this.finish(resolve, e.results[0][0].transcript);
this.recognizer.onerror = (e: any) => this.finish(reject, e);
});
-
}
private sanitize = (title: string) => {