Skip to content

Instantly share code, notes, and snippets.

@deebloo
Last active January 19, 2018 13:15
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 deebloo/2361d7f9565844f666719a3bc9020561 to your computer and use it in GitHub Desktop.
Save deebloo/2361d7f9565844f666719a3bc9020561 to your computer and use it in GitHub Desktop.
Small function for inline workers
function createWorker(fn) {
var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });
var url = URL.createObjectURL(blob);
return new Worker(url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment