Saturday, August 11, 2018

Re: jsInterop to Promise Js function

The timeout is not a promise nor does it act like a promise because a promise is something that your sum() method would actually return to the caller so that the caller can react to the promise outcome by registering callbacks to it. In your example your sum() method returns nothing and you schedule a function that returns a value that nobody will ever receive.

If you would make your sum() method return a real promise then you have to either write the Promise in GWT as well using JsInterop or use elemental2 library and cast it into the promise of elemental2. Then you can wait for the promise to resolve to get the result.


-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment