I have a GWT project and I would like to add a script tag to the main HTML file of the GWT project located in my client code Java function. According to
, I should add something like the following HTML tags:
Where com.myCompany.myProject.client.myClass is the class path and myFunction is the Java function that I want to call.
When I have nothing with the following implementation of my function:
public zero myFunction () {HTMLPanel panel = new HTMLPanel ( ) "I have been called"); . Add RootPanel.get () (panel); } That is, myFunction is not being called.
But when I make the same call with the JSN method, it works
thanks
<
"post-text" itemprop = "text">
-
The work you are trying to do is not working because the GWT compiler has produced code size To reduce the name of all identifier names changes: Therefore myfunction () is present, but it is called something else.
You were looking at the old version of the documentation. The following is explained in the latest version:
Solution - Add an additional method somewhere:
public static original zero export myfunction () / * - {$ wnd.myfunction = $ entry (@ com.myCompany.myProject.client.myClass :: myFunction ()); } - * /; Then you must call EnclosingClass.exportMyFunction () at the beginning of your app. Then in hand-drawn javascript, you can access it like this:
window.myfunction ();
Comments
Post a Comment