Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created November 12, 2010 23:14
Show Gist options
  • Save rwaldron/674882 to your computer and use it in GitHub Desktop.
Save rwaldron/674882 to your computer and use it in GitHub Desktop.
<script src="renderer.js"></script>
var worker = new Worker('worker.js');
worker.addEventListener('message', function (event) {
var message = event.data;
console.log( message );
}, false);
// Send an object message to the worker
worker.postMessage({
"renderer-process": "Hello Worker Process, I'm an object"
});
// Send a string
worker.postMessage("Hello Worker Process, I'm a string");
self.addEventListener('message', function (event) {
var message = event.data;
this.postMessage({
"worker-process" : "I got it!",
"received:" : message
});
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment