Search code examples
javascriptjavagwt

How to access to functions/variables from GWT code in Javascript?


I am trying to use some functions from a code that has been obfuscated. So i have an html file that is calling a JS file thru the tag:

<script src="gwt_svg_viewer/gwt_svg_viewer.nocache.js"></script>

that file is defining a function called "onScriptdownloaded" which receives a string like this:

gwt_svg_viewer.onScriptDownloaded(["var $wnd = window.parent;function RE(){}"]);

So my question is how can i access to RE? in another JS file?

It seems that there was a kind of GWT code implemented, but i am not really familiar with that.


Solution

  • Variable names and functions in gwt will be obfuscated every time you compile your project, and variables and functions will be renamed in the process, in order to call a gwt code from javascript in a consistence manner you will need to use jsinterop to export java types. more information can be found in the gwt jsinterop documentation