micropython/tests/ports/webassembly
Damien George 8a3546b3bd webassembly: Add JavaScript-based asyncio support.
This commit adds a significant portion of the existing MicroPython asyncio
module to the webassembly port, using parts of the existing asyncio code
and some custom JavaScript parts.

The key difference to the standard asyncio is that this version uses the
JavaScript runtime to do the actual scheduling and waiting on events, eg
Promise fulfillment, timeouts, fetching URLs.

This implementation does not include asyncio.run(). Instead one just uses
asyncio.create_task(..) to start tasks and then returns to the JavaScript.
Then JavaScript will run the tasks.

The implementation here tries to reuse as much existing asyncio code as
possible, and gets all the semantics correct for things like cancellation
and asyncio.wait_for.  An alternative approach would reimplement Task,
Event, etc using JavaScript Promise's.  That approach is very difficult to
get right when trying to implement cancellation (because it's not possible
to cancel a JavaScript Promise).

Signed-off-by: Damien George <damien@micropython.org>
2024-04-24 16:24:00 +10:00
..
asyncio_create_task.mjs webassembly: Add JavaScript-based asyncio support. 2024-04-24 16:24:00 +10:00
asyncio_create_task.mjs.exp webassembly: Add JavaScript-based asyncio support. 2024-04-24 16:24:00 +10:00
asyncio_sleep.mjs webassembly: Add JavaScript-based asyncio support. 2024-04-24 16:24:00 +10:00
asyncio_sleep.mjs.exp webassembly: Add JavaScript-based asyncio support. 2024-04-24 16:24:00 +10:00
await_js_async_py.mjs
await_js_async_py.mjs.exp
basic.js
basic.js.exp
filesystem.mjs
filesystem.mjs.exp
float.mjs
float.mjs.exp
fun_call.mjs
fun_call.mjs.exp
fun_proxy.mjs webassembly/proxy_js: Allow a Python proxy of a function to be undone. 2024-03-30 13:13:51 +11:00
fun_proxy.mjs.exp webassembly/proxy_js: Allow a Python proxy of a function to be undone. 2024-03-30 13:13:51 +11:00
fun_py_callback_js.mjs
fun_py_callback_js.mjs.exp
globals.mjs
globals.mjs.exp
heap_expand.mjs
heap_expand.mjs.exp
jsffi_create_proxy.mjs
jsffi_create_proxy.mjs.exp
jsffi_to_js.mjs
jsffi_to_js.mjs.exp
override_new.mjs
override_new.mjs.exp
promise_with_resolvers.mjs
promise_with_resolvers.mjs.exp
py_proxy_delete.mjs
py_proxy_delete.mjs.exp
py_proxy_dict.mjs
py_proxy_dict.mjs.exp
py_proxy_has.mjs
py_proxy_has.mjs.exp
py_proxy_own_keys.mjs
py_proxy_own_keys.mjs.exp
py_proxy_set.mjs
py_proxy_set.mjs.exp
py_proxy_to_js.mjs
py_proxy_to_js.mjs.exp
register_js_module.js
register_js_module.js.exp
run_python_async.mjs
run_python_async.mjs.exp
run_python_async2.mjs
run_python_async2.mjs.exp
this_behaviour.mjs
this_behaviour.mjs.exp
various.js
various.js.exp