Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE HTML>
<html>
<script>
var worker1 = new Worker("simple-worker.js");
var worker2 = new Worker("simple-worker.js");
var count = 0;
function timer() {
var n = ++count;
console.log("MAIN THREAD SAYS HELLO! " + n);
}
setInterval(timer, 1000);
window.sayHello = () => {
worker1.postMessage({yo: 'yo 1'})
worker2.postMessage({yo: 'yo 2'})
}
</script>
<body>
Hello World!
</body>
</html>