Creating JavaScript modules with TeaVM #892
konsoletyper
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently I published TeaVM preview (0.10.0-dev-8) which provides the ability to create JavaScript modules from Java code. This feature was requested by many TeaVM users for several years. Now it becomes possible without extra hacks.
Briefly, TeaVM comes with two new features: module type selection and exporting non-main methods. Since 0.9.0 TeaVM produces UMD wrappers instead of immediately-invoked function. Now it becomes possible to customize wrapper, and one of the is ES2015 module.
Another important thing is ability not only to import declarations from JavaScript (by means of implementing
JSObject
interface and using@JSBody
annotation), but to export Java declarations to JavaScript. All details you can find in the documentation.Note that this is only the very first implementation. I'm looking forward into implementing several improvements:
and so on.
I'd be glad if you tested these features and provided feedback.
And please, don't forget that TeaVM needs your donates. If you like this project, or if these recent features are especially helpful for you use case and you want to thank me, become my sponsor, so I could have extra free cappuccino (or perhaps even extra free Pho Bo) every month.
Beta Was this translation helpful? Give feedback.
All reactions