Skip to content

Instantly share code, notes, and snippets.

@ericwooley
Created October 11, 2016 20:47
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 ericwooley/bd934f49db7c6185172a097e69061d88 to your computer and use it in GitHub Desktop.
Save ericwooley/bd934f49db7c6185172a097e69061d88 to your computer and use it in GitHub Desktop.
Web worker from local function
function testFunction () {
console.log('webworker success')
}
var worker = new Worker(URL.createObjectURL(new Blob(['(' + testFunction.toString() + ')()'], {type: 'application/javascript'})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment