Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asynchronous 在Google Apps脚本上运行异步函数_Asynchronous_Google Apps Script_Async Await_Webassembly - Fatal编程技术网

Asynchronous 在Google Apps脚本上运行异步函数

Asynchronous 在Google Apps脚本上运行异步函数,asynchronous,google-apps-script,async-await,webassembly,Asynchronous,Google Apps Script,Async Await,Webassembly,我试图在新的V8 Google Apps脚本运行时上运行WebAssembly,它似乎受到支持,但异步函数似乎在返回承诺后终止 let wasm= new Uint8Array([/* snip */]).buffer function add(a,b) { return((async()=>{ console.log("running function...") results=await WebAssembly.instantiate(wasm) r

我试图在新的V8 Google Apps脚本运行时上运行WebAssembly,它似乎受到支持,但异步函数似乎在返回承诺后终止

let wasm= new Uint8Array([/* snip */]).buffer
function add(a,b) {
  return((async()=>{
  console.log("running function...")
  results=await WebAssembly.instantiate(wasm)
  return results.instance.exports.add(a,b)
})());
}
function test(){
  add(2,3).then(console.log).catch(console.error)
}
当我运行
测试时
“运行功能…”被记录,然后什么都没有。没有错误,没有结果。我已经确认
WebAssembly.instantiate
返回承诺。 有人知道发生了什么吗?或者这是问谷歌的问题吗

更新:

上创建了一个问题异步功能在V8中似乎还不完全受支持。事实上,关于这一点,有一个很好的解释。您可以单击页面左上角的星号来跟踪此问题

在任何情况下,请注意,在V8中没有明确说明这些功能的可用性。它只是声明您可以在代码中使用像
async
这样的关键字,但没有提到如果您使用它,您将获得什么功能

参考:

确保您的snip是有效的模块。如果是,请在issuetracker中创建问题。有关更多详细信息,请参阅。确切的代码也适用于浏览器,因此它是有效的。如果您创建问题,请将其链接到此处以获得更广泛的访问权限。请访问