Join Bill Weinman for an in-depth discussion in this video Deploying a worker, part of HTML5: Background Processes with Web Workers.
This is a simple example of an application that uses a web worker to calculate a…series of prime numbers.…This is running on my server. Of course, you will be running it on your own…server, or you can set up a server on your local machine using something like XAMPP.…The way this works is once you press the Start button a signal was sent to a…worker that starts a timer and calculates a series of prime numbers fifteen times per…second to match the speed of these videos.…So, if I press the Start button, we see that it starts calculating prime numbers.…
For each prime it's found, the worker sends a message back to the main…JavaScript thread with the result, which is then displayed using an HTML5 output tag.…So let's take a look at how the code works.…I'm going to press this Stop button now, and here's the HTML file.…I'm just going to scroll through it first for you so that those of you who were…typing along can do that.…We'll scroll off to the side here. That's a little bit tricky to do.…There we go. And we can see the way that this works.…
Released
1/9/2012- Deploying a worker
- Detecting browser support
- Communicating with workers
- Understanding API differences in shared workers
Share this video
Embed this video
Video: Deploying a worker