idea plugin jbCefJSQuery return undefined
Answered
I am developing idea plugin which embeds jcef browser, i use jbCefJSQuery to call plugin from browser, but browser get undefined
response, why? btw i'm certain that plugin side received the callIde
call
plugin code :
this.jbCefBrowser.getCefBrowser().executeJavaScript(
"window.callIde = function(requestStr) {" + jbCefJSQuery.inject("requestStr") + "};", this.jbCefBrowser.getCefBrowser().getURL(), 0);
jbCefJSQuery.addHandler((requestStr)->{return new JBCefJSQuery.Response("xxx");});
js code expect xxx
response, but get undefined
:
console.log(window.callIde("aaa"));
Please sign in to leave a comment.
It's an example of an actual request from JS side that contains the callbacks for the response:
JBCefJSQuery
is some sort of a wrapper for this functionality. And itsinject
method basically constructs the text of such call. It does the substitution ofcefQuery
name,request
,onSuccess
andonFailure
values.To consume the response on JS side another version of
JBCefJSQuery#inject
has to be used.