diff --git a/src/components/Editor/Runners/PyodideRunner/PyodideRunner.jsx b/src/components/Editor/Runners/PyodideRunner/PyodideRunner.jsx index b036dfe7b..b2e6d0d35 100644 --- a/src/components/Editor/Runners/PyodideRunner/PyodideRunner.jsx +++ b/src/components/Editor/Runners/PyodideRunner/PyodideRunner.jsx @@ -1,7 +1,16 @@ +import { useMemo } from "react"; + const PyodideRunner = () => { - const worker = new Worker("/webworkers/pyodideWorker.js", { type: "module" }); + const worker = useMemo(loadPyodideWorker, []); + + worker.onmessage = ({ data }) => { + console.log(data); + }; return
Hello, World!
; }; +const loadPyodideWorker = () => + new Worker("/webworkers/pyodideWorker.js", { type: "module" }); + export default PyodideRunner;