Created
October 24, 2014 20:01
-
-
Save zackdouglas/7675fb9a7ed5c8034e29 to your computer and use it in GitHub Desktop.
Inline Web worker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blob = new Blob([ | |
"onmessage = function(e) { postMessage('msg from worker'); }"]); | |
// Obtain a blob URL reference to our worker 'file'. | |
var blobURL = window.URL.createObjectURL(blob); | |
var worker = new Worker(blobURL); | |
worker.onmessage = function(e) { | |
console.dir(e); | |
}; | |
worker.postMessage(); // Start the worker. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment