【发布时间】:2020-07-26 04:25:34
【问题描述】:
我正在尝试在新的 V8 Google Apps 脚本运行时上运行 WebAssembly,它似乎受支持,但似乎异步函数在返回 Promise 后被终止。
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)
}
当我运行test“运行功能...”被记录,然后什么都没有。没有错误,没有结果。我已经确认WebAssembly.instantiate 返回了一个 Promise。
有谁知道发生了什么,或者这是要向 Google 询问的问题?
更新:
【问题讨论】:
-
确保你的 snip 是一个有效的模块。如果是这样,请在 issuetracker 中创建一个问题。有关详细信息,请参阅tag info page。
-
确切的代码也适用于浏览器,所以它是有效的。
-
如果您创建问题,请在此处链接以扩大影响范围
标签: asynchronous google-apps-script async-await webassembly