Created
November 12, 2010 23:14
-
-
Save rwaldron/674882 to your computer and use it in GitHub Desktop.
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
<script src="renderer.js"></script> |
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 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"); |
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
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