Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minimal WebWorker example
<h1>Minimal WebWorker example</h1>
<p>Look in the console!</p>
<script src="main.js"></script>
var worker = new Worker('worker.js');
worker.onmessage = function (e) {
console.log(; // 'pong'
self.onmessage = function (e) {
console.log(; // 'ping'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.