For example, if we modify the function import example and make getCount async.
;; main.wat --> main.wasm
(module
(import "./counter.js" "getCount" (func $getCount (func (result i32))))
)
// counter.js
async function getCount() {
const response = await fetch('//api/get-count');
...
return count;
}
export {getCount};
Given existing behaviour, it would crash at runtime. But should we do better?
Should this rely on or interact with https://github.com/WebAssembly/js-promise-integration?