I want to use the Kurento WebRTC javascript client in my Java web application.
But I even cant manage to call a simple javascript function in my Java application. What am I missing?
var connector = this;
connector.test = function() {
alert('Hello world!');
}
Here comes the Java Code:
import com.vaadin.ui.AbstractJavaScriptComponent;
@JavaScript({"rtc.js", "jquery-1.12.3.min.js"})
public class VideoCall extends AbstractJavaScriptComponent {
public VideoCall() {
}
public void testMethod() {
callFunction("test");
//Page.getCurrent().getJavaScript().execute("alert('Hello world!')");
System.out.println("testMethod executed!");
}
}
When I uncommend
Page.getCurrent().getJavaScript().execute("alert('Hello world!')");
I get a window with the message "Hello world!". When I change test to foo as argument in callFunction I dont get an error message, although foo doesnt exist as function. Why does the code not work?