webassembly/api: Resolve thenables returned from runPythonAsync.
JavaScript semantics are such that the caller of an async function does not need to await that function for it to run to completion. This commit makes that behaviour also apply to top-level async Python code run via `runPythonAsync()`. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -152,7 +152,11 @@ export async function loadMicroPython(options) {
|
||||
[buf, len, value],
|
||||
);
|
||||
Module._free(buf);
|
||||
return proxy_convert_mp_to_js_obj_jsside_with_free(value);
|
||||
const ret = proxy_convert_mp_to_js_obj_jsside_with_free(value);
|
||||
if (ret instanceof PyProxyThenable) {
|
||||
return Promise.resolve(ret);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
replInit() {
|
||||
Module.ccall("mp_js_repl_init", "null", ["null"]);
|
||||
|
||||
Reference in New Issue
Block a user