diff --git a/Autoloader.js b/Autoloader.js index 65d4d32..21e6e15 100755 --- a/Autoloader.js +++ b/Autoloader.js @@ -35,23 +35,29 @@ Autoloader.assetLoader = new AssetManager(); */ Autoloader.defineNamespace = function (namespace) { - if (Autoloader.namespaced.indexOf(namespace) === -1) { - const paths = namespace.split('.'); - paths.splice(0, 1); + if (Autoloader.namespaced.indexOf(namespace) !== -1) { + return; + } - const length = paths.length; - let current = window.omsApp; + const paths = namespace.split('.'); + paths.splice(0, 1); - for (let i = 0; i < length; ++i) { - if (typeof current[paths[i]] === 'undefined') { - current[paths[i]] = {}; - } + const length = paths.length; + let current = window.omsApp; - current = current[paths[i]]; + if (typeof current === 'undefined') { + return; + } + + for (let i = 0; i < length; ++i) { + if (typeof current[paths[i]] === 'undefined') { + current[paths[i]] = {}; } - Autoloader.namespaced.push(namespace); + current = current[paths[i]]; } + + Autoloader.namespaced.push(namespace); }; /** diff --git a/UI/Input/Voice/VoiceManager.js b/UI/Input/Voice/VoiceManager.js index f9bc2f6..b3d56a5 100755 --- a/UI/Input/Voice/VoiceManager.js +++ b/UI/Input/Voice/VoiceManager.js @@ -28,7 +28,7 @@ export class VoiceManager this.recognition = null; this.speechRecognitionList = null; - if (SpeechRecognition !== null) { + if (SpeechRecognition !== null && SpeechGrammarList !== null) { this.recognition = new SpeechRecognition(); this.speechRecognitionList = new SpeechGrammarList(); }