PrepAway - Latest Free Exam Questions & Answers

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.)

PrepAway - Latest Free Exam Questions & Answers

A.
JSON

B.
Window

C.
Parent

D.
String

E.
JavaScript

F.
DOM

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.
HTML5 Web Workers


Leave a Reply