Breaking: new Polyscript Hooks mechanism (#1811)

* Breaking: new Polyscript Hooks mechanism

* Added proper smoke test
This commit is contained in:
Andrea Giammarchi
2023-10-26 17:13:36 +02:00
committed by GitHub
parent 28d37cdead
commit e67eb06d8b
11 changed files with 394 additions and 195 deletions

View File

@@ -1,9 +1,9 @@
// PyScript Error Plugin
import { hooks } from "../core.js";
hooks.onInterpreterReady.add(function override(pyScript) {
hooks.main.onReady.add(function override(pyScript) {
// be sure this override happens only once
hooks.onInterpreterReady.delete(override);
hooks.main.onReady.delete(override);
// trap generic `stderr` to propagate to it regardless
const { stderr } = pyScript.io;