Called from Java GWT code JavaScript function of JS file

I have a button in Java GWT code I have a JavaScript file in the script folder I want to access the function of the JS file on the button button

So how do I call this method from the Java GWT code (click event in Button)?

Anyone can tell me the code or how to access JS file functions

Thank you in advance

Solution

Because your code should not rely on the GWT linker (and how it loads the code), you need to prefix the call with the correct window object Reapp doesn't take this into account So it actually needs to be:

public static native void onMyButtonClick() /*-{
    $wnd.myJSfunction();
}-*/;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>