Share
VIDEOS 1 TO 50
javascript web workers tutorial (  introduction to multithreading in js )
javascript web workers tutorial ( introduction to multithreading in js )
Published: 2016/01/26
Channel: techsith
Using Web Workers for more responsive apps – Jason Teplitz
Using Web Workers for more responsive apps – Jason Teplitz
Published: 2015/10/21
Channel: AngularConnect
3 - JavaScript for Experienced Developers - Web Workers
3 - JavaScript for Experienced Developers - Web Workers
Published: 2016/02/05
Channel: RG Edu
Nolan Lawson - Demystifying Web Workers and Service Workers - CascadiaFest 2016
Nolan Lawson - Demystifying Web Workers and Service Workers - CascadiaFest 2016
Published: 2016/08/17
Channel: Cascadia JS
JavaScript Web Workers Explained
JavaScript Web Workers Explained
Published: 2017/01/29
Channel: Theodore Anderson
JavaScript WebWorker Example
JavaScript WebWorker Example
Published: 2016/05/29
Channel: TechThree INFO
JavaScript Web Workers
JavaScript Web Workers
Published: 2012/10/28
Channel: Timothy Armstrong
How to use Web Workers
How to use Web Workers
Published: 2017/08/09
Channel: GeekLaunch
The ServiceWorker: The network layer is yours to own
The ServiceWorker: The network layer is yours to own
Published: 2014/06/25
Channel: Google Developers
HTML5 Web Workers
HTML5 Web Workers
Published: 2015/06/30
Channel: Sridhar Chinta
Practical Web Workers by Mukund Lakshman @ EmberSF
Practical Web Workers by Mukund Lakshman @ EmberSF
Published: 2016/02/01
Channel: Ember Videos
HTML5 Web Worker Tutorial #10 How to use it
HTML5 Web Worker Tutorial #10 How to use it
Published: 2012/12/11
Channel: Easy Learn Tutorial
Web Worker HTML5 API Tutorials Multi threading in javascript
Web Worker HTML5 API Tutorials Multi threading in javascript
Published: 2016/04/04
Channel: Fruit JS
Introduction to Service Workers
Introduction to Service Workers
Published: 2017/04/26
Channel: Google Chrome Developers
Redux and Web Workers on the Frontend by Dan Tsui at react-europe 2016
Redux and Web Workers on the Frontend by Dan Tsui at react-europe 2016
Published: 2016/06/13
Channel: ReactEurope
HTML5: How To Build Multithreaded Web Applications with Web Workers
HTML5: How To Build Multithreaded Web Applications with Web Workers
Published: 2017/06/29
Channel: Brian Greig
Angular Air Episode 62: Using Web Workers for High Performance Angular 2 Web Apps
Angular Air Episode 62: Using Web Workers for High Performance Angular 2 Web Apps
Published: 2016/04/12
Channel: AngularAir
Ori Calvo - Angular Web Worker - Building Super Responsive UI | AngularUP 2016
Ori Calvo - Angular Web Worker - Building Super Responsive UI | AngularUP 2016
Published: 2017/02/12
Channel: AngularUP
HTML5 Avanzado Web Workers y brackets
HTML5 Avanzado Web Workers y brackets
Published: 2014/05/09
Channel: Pixelpro Cursos
HTML5 getUserMedia and Web Workers
HTML5 getUserMedia and Web Workers
Published: 2013/02/15
Channel: Conor Buckley
How-To :  Web Workers
How-To : Web Workers
Published: 2016/12/07
Channel: Houssem YAHIAOUI
HTML 5 Web Worker Demo
HTML 5 Web Worker Demo
Published: 2010/09/04
Channel: life michael
Nolan Lawson   I like the way you work it   all about Web Workers
Nolan Lawson I like the way you work it all about Web Workers
Published: 2016/06/28
Channel: EmpireJS
Terminating HTML5 WebWorker
Terminating HTML5 WebWorker
Published: 2013/08/04
Channel: life michael
Demo  Fibonacci Sequence with Web Worker  of HTML5
Demo Fibonacci Sequence with Web Worker of HTML5
Published: 2014/12/19
Channel: pokeang ung
Curso HTML 5  API Web Worker I  Vídeo 69
Curso HTML 5 API Web Worker I Vídeo 69
Published: 2014/06/16
Channel: pildorasinformaticas
HTML5 Web Worker Tutorial #11 Example
HTML5 Web Worker Tutorial #11 Example
Published: 2012/12/11
Channel: Easy Learn Tutorial
Ejemplo web workers
Ejemplo web workers
Published: 2016/12/20
Channel: Domingo Arnaldo Ramírez Artigas
Html5 Web Workers Demo
Html5 Web Workers Demo
Published: 2015/07/01
Channel: Sridhar Chinta
Run digest cycle in web worker   Dr  Gleb Bahmutov PhD
Run digest cycle in web worker Dr Gleb Bahmutov PhD
Published: 2015/03/05
Channel: ng-conf
Micro Soft Azure|| Web Role its purpose-Worker Role its purpose - Contd Part - 1
Micro Soft Azure|| Web Role its purpose-Worker Role its purpose - Contd Part - 1
Published: 2016/07/31
Channel: Durga Software Solutions
Parashuram - Rise of the Web Workers
Parashuram - Rise of the Web Workers
Published: 2016/09/15
Channel: ReactRally
Introduction html5 web  worker
Introduction html5 web worker
Published: 2014/12/19
Channel: pokeang ung
Web Workers
Web Workers
Published: 2017/05/01
Channel: O programador
json.async.js - Web Worker Walkthrough
json.async.js - Web Worker Walkthrough
Published: 2013/05/17
Channel: Vtudio2
HTML5 and Web Workers (GDL Israel)
HTML5 and Web Workers (GDL Israel)
Published: 2013/04/28
Channel: Google Developers
Working with HTML5 Microdata, Web Workers, and Web Applications
Working with HTML5 Microdata, Web Workers, and Web Applications
Published: 2015/03/05
Channel: Robin Nixon
HTML Local Storage, App Cache, Web Workers Theory
HTML Local Storage, App Cache, Web Workers Theory
Published: 2016/06/26
Channel: Prakash R
16. Angular 2 Web Workers with Jason Teplitz
16. Angular 2 Web Workers with Jason Teplitz
Published: 2016/02/02
Channel: readthesource
HTML5, CSS3. Урок 6. WebStorage, WebWorker,написание Offline Application
HTML5, CSS3. Урок 6. WebStorage, WebWorker,написание Offline Application
Published: 2013/07/29
Channel: ITVDN
Web Workers in ArcGIS API for JavaScript
Web Workers in ArcGIS API for JavaScript
Published: 2017/05/24
Channel: Rene Rubalcava
Web Worker example in SAPUI5 application
Web Worker example in SAPUI5 application
Published: 2016/03/07
Channel: Jakob Marius Kjær
WebWorker Angular 2 Image Demo Video
WebWorker Angular 2 Image Demo Video
Published: 2015/08/25
Channel: Jason Teplitz
LT - Web Workers in a Nutshell By Stephen Koller
LT - Web Workers in a Nutshell By Stephen Koller
Published: 2015/07/26
Channel: SEM js
HTML5 Tutorial for Power Users 10 Getting Started With Web Workers
HTML5 Tutorial for Power Users 10 Getting Started With Web Workers
Published: 2015/12/30
Channel: Souad Essam
HTML5 - Web Workers
HTML5 - Web Workers
Published: 2014/06/22
Channel: Mauricio Marinho
WEB WORKER CONTEST: exo9.js - Ghoul99.js
WEB WORKER CONTEST: exo9.js - Ghoul99.js
Published: 2014/06/22
Channel: Stefan Trenkel
Demo  Ajax in a Worker of HTML5
Demo Ajax in a Worker of HTML5
Published: 2014/12/19
Channel: pokeang ung
Martin Splitt  - WARPSPEED: High performance tricks: Web Workers, GPU computing and Web
Martin Splitt - WARPSPEED: High performance tricks: Web Workers, GPU computing and Web
Published: 2017/02/20
Channel: The Rolling Scopes
HTML5 27 Web Workers & Server Sent Events IN HINDI
HTML5 27 Web Workers & Server Sent Events IN HINDI
Published: 2017/08/15
Channel: Ajaze Khan
NEXT
GO TO RESULTS [51 .. 100]

WIKIPEDIA ARTICLE

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A web worker, as defined by 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.[1] Web workers are often able to utilize multi-core CPUs more effectively.[2]

The W3C and WHATWG envision web workers as long-running scripts that are not interrupted by user-interface scripts (scripts that respond to clicks or other user interactions). Keeping such workers from being interrupted by user activities should allow Web pages to remain responsive at the same time as they are running long tasks in the background.

The simplest use of workers is for performing a computationally expensive task without interrupting the user interface.

The W3C and the WHATWG are currently in the process of developing a definition for an API for web workers.[1]

Overview[edit]

As envisioned by WHATWG, web workers are relatively heavy-weight. They are expected to be long-lived, have a high start-up performance cost, and a high per-instance memory cost.[1]

Web workers are not intended or expected to be used in large numbers as they could hog system resources.

Web workers allow for concurrent execution of the browser threads and one or more JavaScript threads running in the background. The browser which follows a single thread of execution will have to wait on JavaScript programs to finish executing before proceeding and this may take significant time which the programmer may like to hide from the user. It allows for the browser to continue with normal operation while running the script in the background. The web worker specification[1] is a separate specification from the HTML5 specification[3] and can be used with HTML5.

There are two types of web workers:[1] dedicated and shared workers.

When web workers run in the background, they do not have direct access to the DOM but communicate with the document by message passing. This allows for multi-threaded execution of JavaScript programs.

Features[edit]

Web workers interact with the main document via message passing. The following code creates a Worker that will execute the JavaScript in the given file.

var worker = new Worker("worker_script.js");

To send a message to the worker, the postMessage method of the worker object is used as shown below.

worker.postMessage("Hello World!");

The onmessage property uses an event handler to retrieve information from a worker.

worker.onmessage = function(event) {
	alert("Received message " + event.data);
	doSomething();
}
	
function doSomething() {
	//do work
	worker.postMessage("Work done!");
}

worker.terminate();

Once a worker is terminated, it goes out of scope and the variable referencing it becomes undefined; at this point a new worker has to be created if needed.

Example[edit]

The simplest use of web workers is for performing a computationally expensive task without interrupting the user interface.

In this example, the main document spawns a web worker to compute prime numbers, and progressively displays the most recently found prime number.

The main page is as follows:

<!DOCTYPE html>
<html>
 <head>
  <title>Worker example: One-core computation</title>
 </head>
 <body>
  <p>The highest prime number discovered so far is: <output id="result"></output></p>
  <script>
   var worker = new Worker('worker.js');
   worker.onmessage = function (event) {
     document.getElementById('result').textContent = event.data;
   };
  </script>
 </body>
</html>

The Worker() constructor call creates a web worker and returns a worker object representing that web worker, which is used to communicate with the web worker. That object's onmessage event handler allows the code to receive messages from the web worker.

The Web Worker itself is as follows:

var n = 1;
search: while (true) {
  n++;
  for (var i = 2; i <= Math.sqrt(n); i++)
    if (n % i == 0)
      continue search;
  // found a prime!
  postMessage(n);
}

To send a message back to the page, the postMessage() method is used to post a message when a prime is found.[1]

Support[edit]

If the browser supports web workers, a Worker property will be available on the global window object.[4] The Worker property will be undefined if the browser does not support it.

The following example code checks for web worker support on a browser

function browserSupportsWebWorkers() {
  return typeof window.Worker === "function";
}

Web workers are currently supported by Chrome, Opera, Internet Explorer (version 10), Mozilla Firefox, and Safari.[3][5] Mobile Safari for iOS has supported web workers since iOS 5. The Android browser first supported web workers in Android 2.1, but support was removed in Android versions 2.2–4.3 before being restored in Android 4.4.[6][7]

See also[edit]

References[edit]

  1. ^ a b c d e f Web Workers, WHATWG, retrieved 2010-06-03 
  2. ^ "HTML Living Standard". Html.spec.whatwg.org. 30 January 2017. Retrieved 31 January 2017. 
  3. ^ a b "Introducing HTML5", Lawson, B. and Sharp, R., 2011.
  4. ^ "HTML5 Up and Running" Mark Pilgrim. O'Reilly/Google Press. August 2010
  5. ^ "HTML5 and CSS3" Brian P. Hogan. The Pragmatic Programmers, LLC 2010.
  6. ^ [1][dead link]
  7. ^ "Can I use... Support tables for HTML5, CSS3, etc". caniuse.com. Retrieved 10 June 2017. 

External links[edit]

Specifications
Browser

Disclaimer

None of the audio/visual content is hosted on this site. All media is embedded from other sites such as GoogleVideo, Wikipedia, YouTube etc. Therefore, this site has no control over the copyright issues of the streaming media.

All issues concerning copyright violations should be aimed at the sites hosting the material. This site does not host any of the streaming media and the owner has not uploaded any of the material to the video hosting servers. Anyone can find the same content on Google Video or YouTube by themselves.

The owner of this site cannot know which documentaries are in public domain, which has been uploaded to e.g. YouTube by the owner and which has been uploaded without permission. The copyright owner must contact the source if he wants his material off the Internet completely.

Powered by YouTube
Wikipedia content is licensed under the GFDL and (CC) license