-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run Pyodide in a Web Worker #5
Comments
This may be doable without shipping a separate resource file using |
I was playing around with doing an inline worker: The most promising approach is to use a Blob web worker similar to what is proposed on SO by vsync: <!DOCTYPE html>
<script id="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>
var blob = new Blob([
document.querySelector('#worker1').textContent
], { type: "text/javascript" })
// Note: window.webkitURL.createObjectURL() in Chrome 10+.
var worker = new Worker(window.URL.createObjectURL(blob));
worker.onmessage = function(e) {
console.log("Received: " + e.data);
}
worker.postMessage("hello"); // Start the worker.
</script> |
Indeed, using Initial implementation work here: main...pyodide-worker, combined with Still, it will need more work to get plotting back up and running. Will need to either use tricks like using the bitmap AGG backend and sending results back as base64 encoded Will return to this after |
Comlink should work well here.
Needs research -- Can we distribute a
.js
worker script with a Quarto reveal.js plugin without executing it?The text was updated successfully, but these errors were encountered: