HTML and CSS Reference
Figure 5-1. Creating the Chapter 5 project
In the second dialog select the Basic Project template and make sure the Razor view engine is selected.
Employing Web Workers
With more and more work being done on the client, making the client application multi-threaded becomes more
important. Fortunately, the use of web workers is a convenient way to accomplish that. Functions that are CPU
intensive or may take some time to complete can be executed on a background thread leaving the main UI thread
available to respond to user actions.
execution. The web page can then communicate with the worker through messages. The worker implements the
onmessage event handler to respond to an incoming message from the page and uses the postMessage() function
to send data back to the caller. The caller must also handle the onmessage event to receive the messages from the
worker. This is illustrated in Figure 5-2 .
var worker = new Worker()