File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1368,21 +1368,21 @@ Blockly.JavaScript['sound_recognition'] = function (block) {
13681368 consoleFinal1 = 'console.log("final");\n' ;
13691369 consoleFinal2 = '' ;
13701370 }
1371- var code = 'function ' + speechRecognition + '(){\n' +
1371+ var code = 'async function ' + speechRecognition + '(){\n' +
13721372 ' if (!("webkitSpeechRecognition" in window)) {\n' +
13731373 ' alert("本瀏覽器不支援語音辨識,請更換瀏覽器!(Chrome 25 版以上才支援語音辨識)");\n' +
13741374 ' } else{\n' +
13751375 ' window._recognition = new webkitSpeechRecognition();\n' +
13761376 ' window._recognition.continuous = true;\n' +
13771377 ' window._recognition.interimResults = true;\n' +
13781378 ' window._recognition.lang = "' + dropdown_lang_ + '";\n\n' +
1379- ' window._recognition.onstart = function() {\n' +
1379+ ' window._recognition.onstart = async function() {\n' +
13801380 ' console.log("Start recognize...");\n' +
13811381 ' };\n\n' +
1382- ' window._recognition.onend = function() {\n' +
1382+ ' window._recognition.onend = async function() {\n' +
13831383 ' console.log("Stop recognize");\n' +
13841384 ' };\n\n' +
1385- ' window._recognition.onresult = function(event,result) {\n' +
1385+ ' window._recognition.onresult = async function(event,result) {\n' +
13861386 ' result = {};\n' +
13871387 ' result.resultLength = event.results.length-1;\n' +
13881388 ' result.resultTranscript = event.results[result.resultLength][0].transcript;\n' +
You can’t perform that action at this time.
0 commit comments