Skip to content

Instantly share code, notes, and snippets.



Created May 17, 2010
What would you like to do?
<!DOCTYPE html>
<title>Workers: Basic Demo</title>
document.addEventListener('DOMContentLoaded', function () {
var worker = new Worker('worker-javascript-file.js');
worker.postMessage('Hello Worker!');
worker.addEventListener('message', function (event) {
console.log(; // will log "Hello Main Window!"
}, false);
}, false);
self.addEventListener('message', function (event) {
this.postMessage('Worker', 'Main Window') );

This comment has been minimized.

Copy link

@fearphage fearphage commented Oct 7, 2010

Won't it output Hello Main Window!?


This comment has been minimized.

Copy link
Owner Author

@rwaldron rwaldron commented Oct 7, 2010

Yep! thanks dude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment