Skip to content

Instantly share code, notes, and snippets.

@eddieantonio
Created November 14, 2018 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddieantonio/32a6d22a2eedc867a9b6d72e6271b8b0 to your computer and use it in GitHub Desktop.
Save eddieantonio/32a6d22a2eedc867a9b6d72e6271b8b0 to your computer and use it in GitHub Desktop.
<script>
var url = URL.createObjectURL(new Blob(['(', MyWebWorker.toString(), '())'], {
type: 'text/javascript'
}));
console.log(url);
var worker = new Worker(url);
worker.onmessage = function (event) {
console.log("from worker:", event);
}
function MyWebWorker() {
postMessage('hello');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment