From 5aa746a72d506af55627b896df8d60fc6c69e855 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 26 Aug 2017 16:03:13 +0200 Subject: [PATCH] Add better test --- UI/Input/Voice/VoiceManager.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UI/Input/Voice/VoiceManager.js b/UI/Input/Voice/VoiceManager.js index c30e4e6..7d44d82 100644 --- a/UI/Input/Voice/VoiceManager.js +++ b/UI/Input/Voice/VoiceManager.js @@ -34,7 +34,7 @@ jsOMS.UI.Input.Voice.VoiceManager.prototype.setup = function() { - let self = this; + const self = this; this.recognition.lang = this.lang; this.recognition.interimResults = false; @@ -51,6 +51,10 @@ this.recognition.onresult = function(event) { console.log(event.results[event.resultIndex][0].transcript); + + if(self.commands.hasOwnProperty(event.results[event.resultIndex][0].transcript)) { + self.commands[event.results[event.resultIndex][0].transcript](); + } } this.recognition.onspeechend = function() {