Web Worker API (HTML5 Web Browser Required)

The Web Worker API enables pieces of work be processed on their own threads. Everything run in JavaScript is queued up synchronously. In a high intense web application, a warning message from the web browser that scripts are running and taking a long time to complete may appear on the screen.

In this showcase, the ball will keep moving even an intensive math calculation is in progress (because the Web Worker API is utilized). The math calculation on this web page has a Web Worker to perform the intensive process. To experiment an effect of the intensive process on the movement of the ball, please visit the No Web Worker web page.

To change direction of the ball, use the arrow keys: ⇒ ⇓ ⇐ ⇑

Speed of the ball:
 

Here is the formula of the math calculation:
var i = 0;
var a = new Array(inputNumber);
var sum = 0;
for (i = 0; i < inputNumber; i++) {
   a[i] = i * i;
   sum += i * i;
}


List of Showcases: