Getting started with web workers


show more Getting started with web workers provides you with in-depth training on Developer. Taught by Andy Olsen as part of the HTML5 Power Workshop show less
please wait ...

Getting started with web workers

In this lesson, we're going to see how to do background work in HTML5, by using a Web Worker. This is very handy, if you have some long running task that you need to perform, like a complex calculation. Or if you need to call a webservice that maybe takes ten seconds to come back. You really don't want to do that on the main user interface thread because it would block the user interface. Instead, you can start a BackgroundWorker, like I've got in this example. And in the background, some background work is going to happen while the main user interface remains responsive. So what just happened there? When I clicked that button it created a Web Worker, which posted this message to a background thread. And in the background thread, it spent five seconds being busy and then it posted this response back to the main page.

Now there's no limit on the number of Web Workers you can create from a main page. For example, if you wanted to call five web services that m...

Getting started with web workers
Video duration: 11m 54s 3h 9m Intermediate

Viewers:

Getting started with web workers provides you with in-depth training on Developer. Taught by Andy Olsen as part of the HTML5 Power Workshop

Subjects:
Developer Web video2brain
Software:
HTML
Author:
please wait ...