Fixed issues around XWorker context (#1556)

This commit is contained in:
Andrea Giammarchi
2023-06-22 19:04:57 +02:00
committed by GitHub
parent f6dfc5361e
commit 3b7099cd3d
7 changed files with 38 additions and 24 deletions

View File

@@ -90,14 +90,10 @@ document.head.appendChild(document.createElement("style")).textContent = `
env: "py-script",
interpreter: "pyodide",
codeBeforeRunWorker() {
const { codeBeforeRunWorker: set } = hooks;
const prefix = 'print("codeBeforeRunWorker")';
return [prefix].concat(...set).join("\n");
return [...hooks.codeBeforeRunWorker].join("\n");
},
codeAfterRunWorker() {
const { codeAfterRunWorker: set } = hooks;
const prefix = 'print("codeAfterRunWorker")';
return [prefix].concat(...set).join("\n");
return [...hooks.codeAfterRunWorker].join("\n");
},
onBeforeRun(pyodide, element) {
bootstrapNodeAndPlugins(pyodide, element, before, "onBeforeRun");