Tuesday, August 23, 2016

Re: Completable Future in GWT 2.8-rc1

Looks like a perfect fitting for RxJava, not sure why it add complexity. Promises has no concept of subscription, so requests cannot be canceled, also you will going to need to create a lot of SAM to support generics and lambdas, this is already implemented in RxJava which is pretty mature project used in servers and androids! and now in GWT ;)

This is what can be done in RxJava and you will need lot of code to get there with promises ;)
// this will cancel the previous request… --v …if next click occurs before previous has done
.switchOnNext(event -> autoRestService.loadZeroOneOrLotOfItems()
.doOnSubscribe(() -> table.cleanAndShowLoading() /* do this on each new server request */)
.onErrorResumeNext(err -> { table.stopLoadingAndShowWhy(err); return empty(); }))
.filter(item -> item.name.startWith("iDontLikeThisOne"))
.subscribe(item -> table.addRow(item));
I'll encourage to try it out, AutoREST will just guide you to a more uniform API, instead of the RequestBuilder ModelVistor (https://github.com/intendia-oss/autorest-gwt/blob/master/gwt/src/main/java/com/intendia/gwt/autorest/client/RequestResourceBuilder.java) create your own using native XMLHTTPRequest. If you don't prefer Observable is because you haven't used them ;), hehe or not! I' just trying to promote rxjava-gwt.

On Tuesday, August 23, 2016 at 4:30:06 PM UTC+2, zakaria amine wrote:
I am working with native XMLHTTPRequest. I am trying to write a utility that simplifies the asynchornous calls, and that I can use from my applications to call Rest Services. 

Le mardi 23 août 2016 12:44:30 UTC+2, Ignacio Baca Moreno-Torres a écrit :
I'm curious... what problem are you trying to solve using promises (requests, events, presenter logic...)?

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