Which two tasks can you move to achieve this goal?

You are troubleshooting an application.
Users report that the UI is slow to respond.
You need to improve UI responsiveness by moving application tasks to web workers.
Which two tasks can you move to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)

You are troubleshooting an application.
Users report that the UI is slow to respond.
You need to improve UI responsiveness by moving application tasks to web workers.
Which two tasks can you move to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)

A.
A function that loops through the Document Object Model to update the style of page elements

B.
A long-running calculation that requires looping through an array

C.
A function that performs graphic-intensive animation

D.
A function that stores large amounts of data to local storage

Explanation:

Note:
* Despite the improvements in JavaScript engines, it is not uncommon for users to encounter frozen
user interfaces as the browser works through resource intensive tasks. This leads to a horrible user
experience. The purpose of Web Workers is to give developers a way of instructing the browser to
process large tasks in the background; therefore preventing the UI from freezing up.
* The Web Workers specification defines an API for spawning background scripts in your web
application. Web Workers allow you to do things like fire up long-running scripts to handle
computationally intensive tasks, but without blocking the UI or other scripts to handle user
interactions



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Question

Question

Why C and not D?

Question

Question

From the book: why use a webworker:
1. Performing long-running or slow I/O operations. (Send data to webservice and handle response)
2. Perform lengthy calculations
3. Dividing work between concurrent threads. Operations that involve processing a large amount of data, such as information held in a large array or a file on disk, could be delegated to a collection of concurrent webworkers.

A, not: because webworker does not have acces to DOM of its ‘parent’
B: perfectly possible without the parent.
C, stupid answer which needs clarification imo if just calculation than yes. if application of some kind of DOM from parent than no.
D: not: ww does not have acces to DOM of its ‘parent’ so does not know which files are being processed ->

http://stackoverflow.com/questions/6179159/accessing-localstorage-from-a-webworker
Does ww acces local/sessionstorage?
“No, localStorage and sessionStorage are both undefined in a webworker process.

You would have to call postMessage() back to the Worker’s originating code, and have that code store the data in localStorage.

Interestingly, a webworker can use an AJAX call to send/retrieve info to/from a server, so that may open possibilities, depending on what you’re trying to do.”

anii

anii

So, the best options are B & C?