Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread promises and await
Fri, Dec 11 2020 12:01 PMPermanent Link

erickengelke

Avatar

This is a complex JavaScript question.

First, the eye candy. I made this example which tracks faces in EWB, but I had to resort to writing about 5 lines in pure JavaScript to do it.   

  https://www.eng.uwaterloo.ca/~erick/ewb/faces/faces.html

Now here's the question.

I've done a lot with JavaScript promises in EWB. usually promise(xxx,yyy).then( execthis ) and that works great.

But I've run into an increasing number of libraries that require async/await JavaScript extensions.  And I don't see any way to use them from EWB except by writing a short JavaScript TScript file that calls await in an async function.

One such example is TensorFlow libraries for Aritificial Intelligence which I used in the above.

The probem is knowing when a promise is completed.  If I could poll for it, that would be acceptable.  But I dont think JavaScript allows that.

Is there any way to handle async/await situations without actually  using asycn/await?

Thanks
Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Image