Saturday, 1 October 2011

HTML5 Web Worker

Web workers make it easy to make a process run on a background thread off the UI thread.

This simple example asks a worker thread to return a random number.

Screenshot

You can try it for yourself here:

http://stevenhollidge.com/html5demos/webworkers/index.html

Here’s the code:

index.html

worker.js

Source code can be downloaded here:

http://stevenhollidge.com/blog-source-code/WebWorkerDemo.zip

No comments:

Post a Comment