mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 09:58:39 +00:00
Fix trim bug
This commit is contained in:
parent
68b046a5fc
commit
560867ebfe
|
|
@ -66,10 +66,13 @@
|
|||
this.recognition.onstart = function() {}
|
||||
|
||||
this.recognition.onresult = function(event) {
|
||||
console.log(event.results[event.resultIndex][0].transcript);
|
||||
let result = jsOMS.trim(event.results[event.resultIndex][0].transcript);
|
||||
|
||||
if(self.commands.hasOwnProperty(event.results[event.resultIndex][0].transcript)) {
|
||||
self.commands[event.results[event.resultIndex][0].transcript]();
|
||||
console.log('.' + result + '.');
|
||||
|
||||
if(self.commands.hasOwnProperty(result)) {
|
||||
console.log('found');
|
||||
self.commands[result]();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
*/
|
||||
jsOMS.trim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return jsOMS.ltrim(jsOMS.rtrim(str, char), char);
|
||||
};
|
||||
|
||||
|
|
@ -43,6 +45,8 @@
|
|||
*/
|
||||
jsOMS.rtrim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return str.replace(new RegExp("[" + char + "]*$"), '');
|
||||
};
|
||||
|
||||
|
|
@ -60,6 +64,8 @@
|
|||
*/
|
||||
jsOMS.ltrim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return str.replace(new RegExp("^[" + char + "]*"), '');
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
*/
|
||||
jsOMS.trim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return jsOMS.ltrim(jsOMS.rtrim(str, char), char);
|
||||
};
|
||||
|
||||
|
|
@ -43,6 +45,8 @@
|
|||
*/
|
||||
jsOMS.rtrim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return str.replace(new RegExp("[" + char + "]*$"), '');
|
||||
};
|
||||
|
||||
|
|
@ -60,6 +64,8 @@
|
|||
*/
|
||||
jsOMS.ltrim = function(str, char)
|
||||
{
|
||||
char = typeof char === 'undefined' ? ' ' : char;
|
||||
|
||||
return str.replace(new RegExp("^[" + char + "]*"), '');
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user