mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-13 16:00:37 -05:00
[next] Better Errors - Worker (#1602)
This commit is contained in:
committed by
GitHub
parent
0c54036466
commit
413428f535
28
pyscript.core/test/error.html
Normal file
28
pyscript.core/test/error.html
Normal 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>
|
||||
Reference in New Issue
Block a user