Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

UWP Sample: Webworkers

26.06.2018 (👁4613)


 

 

Standards-based Web Workers are supported for multithreaded JavaScript apps. Web Workers can improve the responsiveness of their UI thread. Web Workers can use the postMessage function to communicate with the UI thread.

This example uses two Web Workers to calculate prime numbers. Even though this task is CPU intensive, the UI remains responsive because of the web workers.

 

Calculate Primes

 

 

 

Code running in a Web worker has access to the <b> setTimeout </ b> and <b> setInterval </ b> methods. These methods can be used to throttle long running scripts or for other general purposes timing. Click the buttons to instruct the worker to set

a timeout or interval timer. At each callback of the timer, the Web Worker posts messages Which are then Displayed by the example.

 

 

Web Workers therefore support channel messaging. Channel Messaging can be used to enable direct communication between workers. In this Example, the UI thread Creates two workers and a set of ports through Which the Web Workers can communicate Directly. The

UI thread then passes the string "Hello World" to the first Web Workers, Which passes it on to the second Web Workers via the specified port, Which then passes it back to the UI thread.

 

 

 

 

One finds the example below

[Lnk "https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WebWorkers" /]