HTML5 Guidelines for Web Developers
246 Chapter 9—WebSockets Figure 9.5 “Battleships!” in demo mode In case of a hit (isShip is true) , the relevant button on the p ...
9.3 Example: Battleships! 247 game.you.grid[msg.field].setAttribute("class", msg.result); deactivateField(); } else if (msg.resu ...
248 Chapter 9—WebSockets Summary With WebSockets, a new protocol has stepped onto the WWW stage. By no means does this spell the ...
10 Web Workers If you have already been experimenting a bit with JavaScript, you may have come across a browser message similar ...
250 Chapter 10—Web Workers object, and the document object. What at first seems like a great limitation is in fact very sensible ...
10.2 Search for Leap Years 251 For web workers, the specification distinguishes between Dedicated Workers and Shared Workers; th ...
252 Chapter 10—Web Workers Clicking the Start button executes the startCalc() function. This reads the step value set in the opt ...
10.3 Calculate Altitude Profiles with Canvas 253 $("y").innerHTML = evt.data.substr(2); } else { $("cnt").innerHTML += "Leap yea ...
254 Chapter 10—Web Workers computation and to output the calculated minimum and maximum altitude along the profile. Once all sec ...
10.3 Calculate Altitude Profiles with Canvas 255 Figure 10.3 CPU usage in calculations with and without web workers 10.3.1 Impor ...
256 Chapter 10—Web Workers In the JavaScript code, we first extract the altitude values from the PNG image. To do this, we load ...
10.3 Calculate Altitude Profiles with Canvas 257 required as reference for the profiles. Then the program logic divides itself i ...
258 Chapter 10—Web Workers Math.round(Math.random()*(evt.data.height-1))]; for (var i=1; i<evt.data.parts; i++) { var p2 = [M ...
Summary 259 if (evt.data.useWorker) { postMessage({task:'update', status:i, id:evt.data.id}); } if (evt.data.useWorker) { postMe ...
This page intentionally left blank ...
11 Microdata Saturday, October 9th 2010, just before half past eight in the evening. Pat Meth- eny steps onto the stage of the s ...
262 Chapter 11—Microdata This could be the beginning of a fictitious review of a concert in an equally fic- titious blog: two pa ...
11.1 The Syntax of Microdata 263 11.1 The Syntax of Microdata If we take the text at the beginning of the chapter and add a few ...
264 Chapter 11—Microdata where prop means properties. If we want to mark all musicians in the text as musicians, we therefore re ...
11.1 The Syntax of Microdata 265 At first glance, the many curly and square brackets may seem confusing, but they disclose the m ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf