Created
January 8, 2014 16:26
-
-
Save alexzaporozhets/8319591 to your computer and use it in GitHub Desktop.
Web Worker for Blob string
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) { | |
alert(e.data) | |
}; | |
worker.postMessage('data'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment