Worker Calculation

Example performing background calculations.

Preview

Code

<button onclick="calc()">Run Calculation</button>

<p id="calc"></p>

<script>
function calc(){
 var worker=new Worker("worker.js");
 worker.onmessage=function(e){
  document.getElementById("calc").innerText=e.data;
 };
}
</script>

More HTML Web Workers Examples (4)