gwt-exporter allows you to export entire classes, certain methods on it, static functions and interfaces, even not modifying the original classes, so you can export an entire library just using auxiliary classes and annotations. Take a look to the documentation of ExportOverlay: https://code.google.com/p/gwt-exporter/wiki/GettingStarted#ExportOverlay
We are not adding new features to gwt-exporter, because the future will be JsInterop which uses the compiler to do the magic instead of generators, but there are a lot of features in gwt-exporter which could not be eventually in jsinterop.
If you need to export something for production right now I'll go with gwt-exporter until jsinterop is ready since their API is still in discussion, it is experimental and some things could fail.
If gwt-export documentation is not good enough, you can take a look to some projects using it, in the way you want, I mean not modifying original classes.
JsQuery: exports gwtquery and produces a clone of jQuery
JsUpload: exports gwtupload
Finally, and answering the question in the subject, GWT does not export everything in order to optimize the JS generated, think that marking anything as exportable using either jsInterop or gwt-exporter, implies that all this code is candidate to be used from JS, so the compiler does not remove it if eventually is not used in your java app.
- Manolo
On Sun, Feb 1, 2015 at 12:20 AM, Joseph Gardi <jgleoj23@gmail.com> wrote:
That's a good point. I understand why they don't export everything automatically now, but if they won't export everything automatically then I want an easier way to export classes without changing them. The most common reason to not change code in order to export it is if it's in a library. Messing with a library's code would be a lot of trouble. GWT exporter's mechanism for exporting classes without changing them is also difficult.
On Saturday, January 31, 2015 at 6:00:29 PM UTC-5, Peter Donald wrote:On Sun, Feb 1, 2015 at 8:58 AM, Joseph Gardi <jgle...@gmail.com> wrote:right now GWT will export things if you tell using GWT exporter. In the GWT 3.0 it'll you can use JsInterfaces etcetera which is much better than GWT exporter and built into the compiler. It seems like it'd still be very complicated to build a hybrid app with GWT and JavaScript because you have to tell the compiler what things to export. Why doesn't GWT just export everything automatically? This would be a dramatic simplification. I understand that there might be a small performance cost but I think it'd be worth it. Doesn't regular javaScript code remain accessible when minified? I don't see why GWT shouldn't do the same.GWT uses an optimizing compiler not a transpiler and minimizer, so GWT does more than just convert java to javascript and minify it. It removes any code it can determine that is not being used. It also rewrites code that is used to be far more optimal, which often results in methods/fields being elided. If "all" code was exported then it could not perform these optimizations and the performance would be intolerably slow. I don't know how GWT exporter works but I presume it is by identifying further entry points that can't be optimized away.--Cheers,
Peter Donald--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://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 "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment