HTML5 : Synchronous communication between Web-worker thread and main thread -


is there way achieve synchronous communication between main thread , web worker threads? know communication through postmessage async, other way (say using sync indexeddb apis) can achieved.

dont think possible , if helps, consider using deferreds cleaner async flow.

so if have synchronous flow like:

var n = 71,  x = checkprime(71); alert(x); //display if n prime or not. 

// can converted async:

var dfd = useworkerforprime(71); dfd.done(function(isprime) {   alert (x); //display if prime  }) 

you return deferred 'useworkerforprime' resolves once message received worker.

reference more deferreds: http://www.erichynds.com/blog/using-deferreds-in-jquery


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -