BrowserComponent Javascript Engine

Viewed 17

I'm rewriting my interface to the javascript engine available in the BrowserComponent but I'm a bit confused. I used to make java methods and objects available to the javascript scripts as below but I admit I can't find a way to do the same now.

Hope you can help.

E.

Object sample:

    JSObject obj = (JSObject) ctx.get("{}");
    if (data != null) {
        for (String key : data.keySet()) {
            obj.set(key, data.get(key));
        }
    }
    ctx.set("window.data", obj);

Method sample:

JSObject devnull = (JSObject) ctx.get("{}");
devnull.set("devnull", new JSFunction() {
    @Override
    public void apply(JSObject self, Object[] args) {
        //How about the args?
    }
});
ctx.set("window.devnull", devnull);

1 Answers

The whole JSObject package has been deprecated for a while. You should use this instead. See this post which discusses the API. You can also find information about that API in the developer guide.

Related