We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a5fa47 commit adfe8d8Copy full SHA for adfe8d8
1 file changed
translate.js
@@ -1,7 +1,7 @@
1
define('Translator', function(){
2
function Translator(locale){
3
this.locale = locale;
4
- this.onResult = {'id' : '', 'text' : ''};
+ this.onResult = null;
5
};
6
7
Translator.prototype.translate = function(recognitionResult){
@@ -13,10 +13,9 @@ define('Translator', function(){
13
lang: recognitionResult.locale + '-' + this.locale
14
},
15
success: function(result) {
16
- translatevariable.onResult.text = result.text;
17
- translatevariable.onResult.id = recognitionResult.id;
18
- console.log(translatevariable);
19
- }
+ if(translatevariable.onResult){
+ translatevariable.onResult({id : recognitionResult.id, text : result.text});
+ }
20
});
21
}
22
return Translator;
0 commit comments