Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created November 16, 2011 19:53
Show Gist options
  • Save westonruter/1371137 to your computer and use it in GitHub Desktop.
Save westonruter/1371137 to your computer and use it in GitHub Desktop.
Spawning a web worker from a function object (bypassing need for separate JS file)
function fibonacci(){ /*...*/ }
var worker = new Worker(
"data:application/javascript;base64,"+
btoa('(' + fibonacci.toString().replace(/function\s+\w+/, 'function') + ')();')
);
// More: https://plus.google.com/113853198722136596993/posts/hAtcYGc5xcw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment