Hi,
I tried by following examples given in this CN1 link
https://codenameone.googlecode.com/svn/trunk/CodenameOne/javadoc/com/codename1/javascript/package-summary.htmlAs per my below code, when I press refresh button, it should call itself and then it should execute this "onStart" event
but I am not getting log output..
final BrowserComponent c = new BrowserComponent();
c.setURL(url);
final JavascriptContext ctx = new JavascriptContext(c);
c.addWebEventListener("onStart", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JSObject logger = (JSObject)ctx.get("{}");
Log.p("before LOGGER");
logger.set("log", new JSFunction(){
public void apply(JSObject self, Object[] args) {
Log.p("in Apply");
String msg = (String)args[0];
Log.p("[Javascript Logger] "+msg);
}
});
ctx.set("window.logger", logger);
Log.p("before ExeStrAndRet");
c.executeAndReturnString("logger.log('my apps output');");
Log.p("after ExeStrAndRet");
}
});
findContainerFF(f).addComponent(c);
Output log printing sequence, when I run, is as following
[EDT] 0:5:23,132 - before LOGGER
[EDT] 0:5:23,145 - before ExeStrAndRet
[EDT] 0:5:23,148 - after ExeStrAndRet
Please can you say is it correct ?
Thanks.