Which code segment should you use?

HOTSPOT
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down
list in the answer area.)

HOTSPOT
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down
list in the answer area.)

Answer:



Leave a Reply 5

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


Wayne

Wayne

To stop worker, we must use self.terminate().

Wayne

Wayne

Sorry! Terminate is used in the main page. Close is used inside the worker.

Firefox360

Firefox360

Your own correction is correct haha. When you want to close the Webworker from within its own code you use close(). Do you want to close it from outside the code (your web-code/main-page) then you should use terminate().

SOUMAIRI

SOUMAIRI

the answer is right