25.02.2013 Views

Peter Lubbers - Pro HTML 5 Programming

Pro HTML 5 Programming

Pro HTML 5 Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Application in Action<br />

CHAPTER 8 ■ USING THE <strong>HTML</strong>5 WEB WORKERS API<br />

To see this example in action, the page blur.html has to be served up by a web server (for example,<br />

Apache or Python’s SimpleHTTPServer). To following steps show how you can use Python<br />

SimpleHTTPServer to run the application:<br />

1. Install Python.<br />

2. Navigate to the directory that contains the example file (blur.html).<br />

3. Start Python as follows:<br />

python -m SimpleHTTPServer 9999<br />

4. Open a browser and navigate to http://localhost:9999/blur.html. You<br />

should now see the page shown in Figure 8-5.<br />

Example Code<br />

For completeness, Listings 9-7, 9-8, and 9-9 contain the full code for the example application.<br />

Listing 8-7. Content of the file blur.html<br />

<br />

<strong>HTML</strong>5 Web Workers<br />

<br />

<strong>HTML</strong>5 Web Workers<br />

Your browser does not support <strong>HTML</strong>5 Web Workers.<br />

Blur<br />

Stop Workers<br />

Reload<br />

Number of Workers<br />

<br />

1<br />

2<br />

4<br />

8<br />

16<br />

<br />

<br />

<br />

<br />

207

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!