Skip to content

Instantly share code, notes, and snippets.

@brentvatne
Created August 25, 2016 19:51
Show Gist options
  • Select an option

  • Save brentvatne/828180ee3509a1e64e247d6969da606a to your computer and use it in GitHub Desktop.

Select an option

Save brentvatne/828180ee3509a1e64e247d6969da606a to your computer and use it in GitHub Desktop.
setTimeout(function() {
postMessage('hello there');
}, 500);
onmessage = function(e) {
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment