An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixed error related to the field

we're using the field `data` for the postMessage whereas the example we based it off of uses `python`. updated to fix the error

+3 -3
+1 -1
app/utils/pyodide/index.ts
··· 117 117 } 118 118 // TODO: Figure out how to get image results from pyodide 119 119 return worker.postMessage({ 120 - data: `plt.plot([1,2,3,4])`, 120 + data: `print('hello world')`, 121 121 }); 122 122 }; 123 123
+2 -2
app/utils/pyodide/webworker.js
··· 16 16 // make sure loading is done 17 17 await pyodideReadyPromise; 18 18 // Don't bother yet with this line, suppose our API is built in such a way: 19 - const { python, ...context } = event.data; 19 + const { data, ...context } = event.data; 20 20 // The worker copies the context in its own "memory" (an object mapping name to values) 21 21 for (const key of Object.keys(context)) { 22 22 self[key] = context[key]; ··· 24 24 // Now is the easy part, the one that is similar to working in the main thread: 25 25 try { 26 26 self.postMessage({ 27 - results: await self.pyodide.runPythonAsync(python), 27 + results: await self.pyodide.runPythonAsync(data), 28 28 }); 29 29 } catch (error) { 30 30 self.postMessage({ error: error.message });