Asynchronous 在Google Apps脚本上运行异步函数
我试图在新的V8 Google Apps脚本运行时上运行WebAssembly,它似乎受到支持,但异步函数似乎在返回承诺后终止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
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
这样的关键字,但没有提到如果您使用它,您将获得什么功能
参考: