Join Bill Weinman for an in-depth discussion in this video Setting up the worker, part of HTML5: Background Processes with Web Workers.
Once we've detected browser support for the workers, setting up the worker is…a very simple matter.…I have here a working copy of detectWorkers-done.html. I'm just going to page…through it here for those of who you are typing this in.…It is a very simple file. And I'm going to start here up at the top where we…have the variables, and I'm going to create a global variable for the worker object itself.…I always initialize my variables, so I'm going to set it null.…Then I am going to come down here to the init function and I'm just going to get…rid of the else clause here off of this testing for the worker, because we…really don't need an else clause.…
If the worker doesn't exist that's why it's a negative test with the exclamation point.…If the worker object doesn't exist then we're just going to display the error…message and return, and if it does exist, we'll go ahead with the initialization,…and that looks like this.…So that's referencing our new global variable that we set there at the top,…
- Deploying a worker
- Detecting browser support
- Communicating with workers
- Understanding API differences in shared workers