Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG), is a JavaScript script executed from an HTML page that runs in the background, independently of other, user- interface scripts that may also have been executed from the same HTML page. Web workers are able to utilize multi-core CPUs more effectively. http://en.wikipedia.org/wiki/Web_worker 5 Sunday, May 19, 13
the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG), is a JavaScript script executed from an HTML page that runs in the background, independently of other, user- interface scripts that may also have been executed from the same HTML page. Web workers are able to utilize multi-core CPUs more effectively. Sunday, May 19, 13
setTimeout/setInterval • Basic Javascript data Structure and Function(Math, Date, Array, etc.) 31 Functions available to workers : https://developer.mozilla.org/en-US/docs/DOM/Worker/Functions_available_to_workers Sunday, May 19, 13
Code syntax highlighting or other real-time text formatting • Spell checker • Analyzing video or audio data • Background I/O or polling of web services • Processing large arrays or humungous JSON responses • Image filtering in <canvas> • Updating many rows of a local web database 37 Sunday, May 19, 13
new Blob([jscontent], {type:'application/javascript'}); var blobWorker_url = URL.createObjectURL(blobWorker); URL.revokeObjectURL(blobWorker_url); inlineWorker.terminate(); var inlineWorker = new Worker(blobWorker_url); require text plugin Master Release resource Sunday, May 19, 13
* 1024 * 32; // 32MB var arrayBuffer = new ArrayBuffer(SIZE); var uInt8View = new Uint8Array(arrayBuffer); var originalLength = uInt8View.length; for (var i = 0; i < originalLength; ++i) { uInt8View[i] = i; } worker.postMessage(uInt8View.buffer, [uInt8View.buffer]); Master Sunday, May 19, 13
//If the buffer is transferred and not copied, its .byteLength will go to 0: if (ab.byteLength) { alert('Transferables are not supported in your browser!'); } else { // Transferables are supported. } http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast Master Sunday, May 19, 13