Hi
I have a half-baked tool that can convert most WebIDL to JSInterop. You can try it out.
https://github.com/rhmoller/embrace
You can drop .idl files containing pure webidl or .html files containing webidl fragments (like the specs from w3 and whatwg) into to the
webapis/data folder
and it will generate a gwt module for you if you run
The gwt module is now in
webapis/build/libs/webapis.jar
In order to bootstrap it you need a bit of JSNI like this
https://github.com/rhmoller/embrace/blob/master/examples/src/main/java/com/giddyplanet/embrace/examples/client/Examples.java#L83-L89
Regarding Enums: I don't think it is supported. It would be nice if we could create a Java enum and have an annotation for specifying the JS value for each enum value. I have the same problem in the embrace tool. WebIDL enums are Strings and some of the enum values in some specs are not valid Java identifier. So currently I generate an oldschool interface with constants.
Best regards
Rene
Den torsdag den 14. januar 2016 kl. 15.48.26 UTC+1 skrev DavidN:
-- I have a half-baked tool that can convert most WebIDL to JSInterop. You can try it out.
https://github.com/rhmoller/embrace
You can drop .idl files containing pure webidl or .html files containing webidl fragments (like the specs from w3 and whatwg) into to the
webapis/data folder
and it will generate a gwt module for you if you run
./gradlew :webapis:jar
The gwt module is now in
webapis/build/libs/webapis.jar
In order to bootstrap it you need a bit of JSNI like this
https://github.com/rhmoller/embrace/blob/master/examples/src/main/java/com/giddyplanet/embrace/examples/client/Examples.java#L83-L89
Regarding Enums: I don't think it is supported. It would be nice if we could create a Java enum and have an annotation for specifying the JS value for each enum value. I have the same problem in the embrace tool. WebIDL enums are Strings and some of the enum values in some specs are not valid Java identifier. So currently I generate an oldschool interface with constants.
Best regards
Rene
Den torsdag den 14. januar 2016 kl. 15.48.26 UTC+1 skrev DavidN:
Is there a way to generate JsInterop compatible classes/interfaces for all HTML5 javascript features ?I'm interested in the new File API's, XMLHttpRequest, EventHandlers, ... etc. I can type it by hand, butsomebody must have done the work already or there must be a tool available to generate it ?What I am missing right now is: how can I map Java enums to integers in an JsInterop interface ?For example the HTML Event type contains this:const unsigned short NONE = 0;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute unsigned short eventPhase;I would like to expose these as java enums ... is that possible ?
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