Sunday, December 11, 2016

Re: GWT JsInterop to Java Rhino ?

Not all JS libraries are purely view related. For example I have an application where I have to make sure that dates and times are properly converted between timezones or do loan calculations. In that part of the code I am using the MomentJS library. I could indeed use a GWTTestCase, but I was just wondering if in some cases it would not be better to use Rhino. It is just one example... the more and more I work with GWT 2.8, the less and less I want to use of the GWT user classes, since they are on the way out anyway.


On Fri, Dec 9, 2016 at 1:31 PM Ignacio Baca Moreno-Torres <ignacio@bacamt.com> wrote:
But, IMO you better separate JS dependant code trying to move it to the view, leaving the presenter with plain java code. We use JsInterop for DTOs, and with a few limitations, it works seamlessly in Java and JS. But trying to execute a JS lib with a JsInterop "wrapper" in JRE sounds like cycle of transformations… Java to Js to Java. Or maybe I don't understand the use case. Just curious, what is the JS lib your presenters depends on? Because usually, this JS lib are used in the view. Anyways, gwt junit test using suites are fast (sometimes).

Just to clarify, IMO your problem is not using JsInterop in JRE tests, but accessing a JS lib. JsInterop can be used to expose your java code to JS or to access JS from your Java code, you only have problems in the second case because you need the JS lib, and I think that this is what GWT test are for.


On Friday, December 9, 2016 at 10:15:08 AM UTC+1, DavidN wrote:
Is anybody working on a APT that can take JsInterop annotated classes of native JS libraries and generate the needed code to access them from Java ?
That would make my life much simpler when unit testing my presenters that rely on JsInterop.

--
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.

--
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