Transpile plain Java project WITHOUT references to any UI, DOM, or any other web/framework features

109 views
Skip to first unread message

Igor

unread,
Jun 29, 2017, 7:13:36 AM6/29/17
to GWT Users
Hi all,

I have a Java project which performs scientific calculations. It does not have any dependencies and it does not reference any UI, DOM, or any other web environment features. It is basically a few custom data structures and algorithms. I wish to expose one class in this project using JsInterop and consume it in a React Native and React app.

I've successfully transpiled the Java into Javascript, but I am unable to use it my React Native app because the resulting Javascript seems to reference UI elements (there's always "var $wnd = $wnd || window.parent..." at the top of the cache.js file which React Native chokes on). Is there a way to achieve my goal and, if so, how?

Thanks,

Igor

Ryan Peden

unread,
Jul 20, 2017, 4:16:23 PM7/20/17
to GWT Users
I realize this question is a couple of weeks old, but I figure it's still worth answering in case you haven't found a solution. 

Do you run

require('react-native') 

before you try to load your GWT library? When RN loads, it does define a global window object. I haven't tried using GWT generated code in React Native, but I've used them both quite heavily in the past, so I'll give it a try and see how it goes. 
Reply all
Reply to author
Forward
0 new messages