Skip to Content

Hi,

As we know Web worker is comes under HTML 5 environment.

Here we will discuss some new ideas about web worker and drawback about our old function calls.

Introduction:

1. Web Worker- executing scripts in an HTML page, the page becomes unresponsive until the script is finished

2. Web Worker- Runs in the background, independently of other scripts

Advantage of Web Worker- function:

1. Asynchronously via callback functions

2. No regression to other thread

Drawback in Normal function call (SAP UI5 environment):

1. It create single thread to all functions

2. It is difficult to use setTimer function to multiple function calls in single click

Worker function:

1. How to create instance –

       new Worker(“YourJAVASCRIPTNAME.js”)

      w.onmessage = function(event) {

       }

      Here we will get our response by using postMethod()

Principles:

1. It open one new thead,and create an instance to your function

Uses:

1. Asynchronous way to run function calls

2. we can set a timer while executing more function calls in a single shot

Note:

1. we can’t able to get data from our parent classes/object.

Please shoot your questions 🙂

Links: http://www.w3schools.com/html/html5_webworkers.asp

Thanks,

Karthik A

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply