Hi Bauna,

here is what I did so far, and it is working fine for now: 

@JsType(isNative=true, namespace=GLOBAL)
public class Promise {
@JsConstructor
public Promise(PromiseExecutor executor){
}
//catch is a keyword in java
@JsMethod(name = "catch")
public native Promise onException(Function reject);
public native Promise then(Function resolve);

}

@JsFunction
@FunctionalInterface
public interface PromiseExecutor {
public void executor(Function resolve, Function reject);

}

@JsFunction
@FunctionalInterface
public interface Function {
public Object call(HTTPResponse event);

}

//...
Promise promise = new Promise(new PromiseExecutor() {

@Override
public void executor(Function resolve, Function reject) {
//do something 
                                resolve(value);


}

});

//...

promise.then(new Function(){
@Override
public Object call(Object resp) {
                        // Do something with resp, which is your resolved 
value
return null;
}
 
 
 });


Le mardi 23 août 2016 14:35:50 UTC+2, Bauna a écrit :
>
> Hi Zakaria,
> Do you have any example of how do you use Promises from GWT?
>
>
> On 23/08/16 06:07, zakaria amine wrote:
>
> Thanks for the info. rxjava-gwt sounds promising, it does add some 
> complexity though...I will do with Promise for now.
>
>
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to