You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we start adding onto the initialization routine, we should move away from placing Pyodide on the main thread and onto a separate worker thread. This will give less of a "freeze" feeling while still allowing us to maintain a single shared environment. Plus, this allows us to move away from the matplotlib-pyodide's backends in favor just an IO stream re-capture.
The most promising approach is to use a Blob web worker similar to what is proposed on SO by vsync:
<!DOCTYPE html><scriptid="worker1" type="javascript/worker">// This script won't be parsed by JS engines because its type is javascript/worker.self.onmessage=function(e){self.postMessage('msg from worker');};// Rest of your worker code goes here.</script><script>varblob=newBlob([document.querySelector('#worker1').textContent],{type: "text/javascript"})// Note: window.webkitURL.createObjectURL() in Chrome 10+.varworker=newWorker(window.URL.createObjectURL(blob));worker.onmessage=function(e){console.log("Received: "+e.data);}worker.postMessage("hello");// Start the worker.</script>
By the looks of it, the use of a blob will be supported on modern browsers (~ < 5 years)
As we start adding onto the initialization routine, we should move away from placing Pyodide on the main thread and onto a separate worker thread. This will give less of a "freeze" feeling while still allowing us to maintain a single shared environment. Plus, this allows us to move away from the
matplotlib-pyodide
's backends in favor just an IO stream re-capture.The most promising approach is to use a Blob web worker similar to what is proposed on SO by vsync:
By the looks of it, the use of a
blob
will be supported on modern browsers (~ < 5 years)https://caniuse.com/bloburls
The text was updated successfully, but these errors were encountered: