Firefox fixes

This commit is contained in:
Dennis Eichhorn 2017-09-01 19:34:47 +02:00
parent 706b59cd5f
commit 981b73e184
3 changed files with 67 additions and 12 deletions

View File

@ -0,0 +1,34 @@
/**
* App notification.
*
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Notification.App */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.App');
jsOMS.Message.Notification.App.AppNotification = function()
{
this.status = 0;
};
jsOMS.Message.Notification.App.AppNotification.prototype.setStatus = function(status)
{
this.status = status;
}
jsOMS.Message.Notification.App.AppNotification.prototype.requestPermission = function()
{
const self = this;
};
jsOMS.Message.Notification.App.AppNotification.prototype.send = function(msg)
{
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -14,9 +14,9 @@
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Voice');
// todo: remove once obsolete
var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
/**
* @constructor
@ -28,9 +28,13 @@
this.pitch = 1;
this.rate = 1;
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
this.voices = window.speechSynthesis.getVoices();
this.voice = this.voices[0];
this.voices = [];
this.voice = null;
if(SpeechRecognition !== null) {
this.voices = window.speechSynthesis.getVoices();
this.voice = this.voices[0];
}
};
/**

View File

@ -14,9 +14,9 @@
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Voice');
// todo: remove once obsolete
var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
/**
* @constructor
@ -26,10 +26,15 @@
jsOMS.UI.Input.Voice.VoiceManager = function (app, commands, lang)
{
this.app = app;
this.recognition = new SpeechRecognition();
this.speechRecognitionList = new SpeechGrammarList();
this.commands = typeof commands === 'undefined' ? {} : commands;
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
this.recognition = null;
this.speechRecognitionList = null;
if(SpeechRecognition !== null) {
this.recognition = new SpeechRecognition();
this.speechRecognitionList = new SpeechGrammarList();
}
};
/**
@ -41,6 +46,10 @@
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.setup = function()
{
if(SpeechRecognition === null) {
return;
}
const self = this;
this.recognition.lang = this.lang;
@ -127,6 +136,10 @@
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.start = function()
{
if(SpeechRecognition === null) {
return;
}
this.recognition.start();
};
@ -139,6 +152,10 @@
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.stop = function()
{
if(SpeechRecognition === null) {
return;
}
this.recognition.stop();
};
}(window.jsOMS = window.jsOMS || {}));