[next] Better Errors - Worker (#1602)

This commit is contained in:
Andrea Giammarchi
2023-07-19 13:20:03 +02:00
committed by GitHub
parent 0c54036466
commit 413428f535
5 changed files with 81 additions and 35 deletions

View File

@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
</head>
<body>
<div>See console ➡️</div>
<script type="micropython">
from xworker import XWorker
def handle_error(event):
print("Python")
print(event.data.message)
w = XWorker('./error.py')
w.onerror = handle_error
</script>
<script type="module">
import { XWorker } from "../core.js";
const w = new XWorker("./error.py", { type: "micropython" });
w.onerror = ({ data: error }) => {
console.log('JS', error);
};
</script>
</body>
</html>