Skip to content

Commit

Permalink
Print worker messages to the JavaScript console
Browse files Browse the repository at this point in the history
  • Loading branch information
tuzz committed Jan 19, 2024
1 parent df2af18 commit 53b5a04
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Editor/Runners/PyodideRunner/PyodideRunner.jsx
Original file line number Diff line number Diff line change
@@ -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 <p>Hello, World!</p>;
};

const loadPyodideWorker = () =>
new Worker("/webworkers/pyodideWorker.js", { type: "module" });

export default PyodideRunner;

0 comments on commit 53b5a04

Please sign in to comment.