I am new to Promises and need some advice on how to handle a returned Promise in a JSNI method called from Java. Can't use JsInterop due to older version 2.7 of GWT. Any advice is appreciated.
Thanks for your time!
I am new to Promises and need some advice on how to handle a returned Promise in a JSNI method called from Java. Can't use JsInterop due to older version 2.7 of GWT. Any advice is appreciated.
Thanks for your time!
If you just have to read properties on the return object, you may try treating it as
JSONObject.Alternatively you could call a method of your Java object in the resolver function of the promise to check conditions to decide if you want to resolve/reject.
p.then()could be called withonFulfilled/onRejectedfunctions just wrapping Java method calls to handle the result.Example:
This is an untested example.