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
Post a Comment