Per*_*me. 5 asynchronous google-apps-script async-await webassembly
我正在尝试在新的 V8 Google Apps Script 运行时上运行 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)
}
Run Code Online (Sandbox Code Playgroud)
当我运行test“正在运行的函数...”被记录时,然后什么都没有。没有错误,没有结果。我已经确认WebAssembly.instantiate返回一个 Promise。有谁知道发生了什么,或者这是要问谷歌的事情吗?
| 归档时间: |
|
| 查看次数: |
1828 次 |
| 最近记录: |