PdfPrep.com

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

Answer: A, D, E

Explanation:

* 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 thread executing a JavaScript file.

* (A, D) In the first implementations of web workers the browsers only allowed strings to be exchanged as messages. However, recent implementations allow for exchange of values or JSON objects.

Reference: HTML5 Web Workers

Exit mobile version