Fix #1998 - Allow lazy terminal bootstrap + MicroPython terminal

* Fix #1998 - Allow lazy PyTerminal bootstrap

* Fix #1998 - Allow lazy terminal bootstrap / runtime

* Implemented mpy terminal in both main and worker

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Andrea Giammarchi
2024-04-03 15:50:20 +02:00
committed by GitHub
parent 1447cb3094
commit 4e4ac56729
5 changed files with 295 additions and 231 deletions

View File

@@ -13,7 +13,7 @@
def greetings(event):
print('hello world')
</script>
<py-script worker terminal>
<script type="mpy" worker terminal>
# works on both worker and main scripts
print("__terminal__", __terminal__)
@@ -25,8 +25,12 @@
# this works as expected
print("this goes to stderr", file=sys.stderr)
document.addEventListener('click', lambda event: print(event.type));
</py-script>
document.addEventListener('click', lambda event: print(event.type))
# this works on MicroPython too
import code
code.interact()
</script>
<button id="my-button" py-click="greetings">Click me</button>
</body>
</html>