idea plugin jbCefJSQuery return undefined
已回答
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"));
请先登录再写评论。
It's an example of an actual request from JS side that contains the callbacks for the response:
JBCefJSQueryis some sort of a wrapper for this functionality. And itsinjectmethod basically constructs the text of such call. It does the substitution ofcefQueryname,request,onSuccessandonFailurevalues.To consume the response on JS side another version of
JBCefJSQuery#injecthas to be used.