READ Free Dumps For Microsoft- 70-480
Question ID 14990 | You are developing an HTML5 page named main.html. The JavaScript code for the main
page is located in a file named myApp.js.
You need to create a web worker and instantiate it from main.html.
Where should you place the web worker code?
|
Option A | In the myApp.js file
|
Option B | In the main.html file
|
Option C | In a separate .js (JavaScript) file
|
Option D | In a separate executable file
|
Correct Answer | C |
Explanation Explanation: Spawning a dedicated worker Creating a new worker is simple. All you need to do is call the Worker() constructor, specifying the URI of a script to execute in the worker thread (main.js): var myWorker = new Worker("worker.js"); Reference: Using Web Workers
Question ID 14991 | 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.)
|
Option A | A function that loops through the Document Object Model to update the style of page elements
|
Option B | A long-running calculation that requires looping through an array
|
Option C | A function that performs graphic-intensive animation
|
Option D | A function that stores large amounts of data to local storage
|
Correct Answer | B,C |
Explanation 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