Home » Microsoft » 70-480 v.2 » Which three types of objects should you use?
You are developing a web application that uses web workers to process images extracted from an HTML5 CANVAS object on a web page.
You need to pass messages between the web workers and the web page.
Which three types of objects should you use? (Each correct answer presents a complete solution. Choose three.)
A. JSON
B. Window
C. Parent
D. String
E. JavaScript
F. DOM
Correct Answer: ADE
Explanation/Reference:
*Example:
var myHelloWorker = new Worker(‘helloworkers.js’);
You’ll then start the worker (and thus a thread under Windows) by sending it a first message:
myHelloWorker.postMessage();
Indeed, the Web Workers and the main page are communicating via messages. Those messages can be formed with normal strings or JSON objects.
*(E) The Web Workers API makes it possible to execute a JavaScript file asynchronously and autonomously. A web worker is essentially a threadexecuting a JavaScript file.
*(A, D) In the first implementations of web workers the browsers only allowed strings to be exchanged as messages. However, recent implementationsallow for exchange of values or JSON objects.
Reference: HTML5 Web Workers