Skip to content

Instantly share code, notes, and snippets.

@laser
Created October 28, 2013 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laser/7191998 to your computer and use it in GitHub Desktop.
Save laser/7191998 to your computer and use it in GitHub Desktop.
// our main code, in a <script>-tag in our HTML page
var piWorker = new Worker("pi_calculator.js");
var logResult = function(e) {
console.log("PI: " + e.data);
};
piWorker.addEventListener("message", logResult, false);
piWorker.postMessage(100000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment