Updated Polyscript with its workers feature (#2104)

* Updated Polyscript with its workers feature
* Worked around the inconsistent behavior between Pyodide and MicroPython
* Fixed Pyodide greedy access to undesired Proxy fields
This commit is contained in:
Andrea Giammarchi
2024-06-26 14:01:22 +02:00
committed by GitHub
parent 7b8ef7ebe2
commit 6f49f18937
10 changed files with 204 additions and 83 deletions

View File

@@ -0,0 +1,19 @@
from pyscript import document, workers
async def test(interpreter):
# accessed as item
named = await workers.micropython_version
version = await named.micropython_version()
document.body.append(version)
document.body.append(document.createElement("hr"))
# accessed as attribute
named = await workers["pyodide_version"]
version = await named.pyodide_version()
document.body.append(version)
document.body.append(document.createElement("hr"))
document.documentElement.classList.add(interpreter)