Closed mksantoki closed 5 years ago
@mksantoki Sorry,Currently not support returning object to js。
I thought about how to support this situation by modify the code, I briefly talk about the idea.
@JSBridgeMethod
public JBMap testReturnObject() {
WritableJBMap jbMap = new WritableJBMap.Create();
jbMap.putString("data", "abc");
jbMap.putCallback("toast", new JBCallback() {
@Override
public void apply(Object... args) {
}
});
return jbMap;
}
Note: WritableJBMap
not support JBCallback convert to JS function now
modify com/apkfuns/jsbridge/JBUtilMethodFactory.java#CallMethod
, parse r.msg
to js Object and return
buffer.append("var r = _callJava(id, moduleName, methodName, args);");
buffer.append("if (r && r.success){");
buffer.append("if(ret)return r.msg");
When I am free, I will think deeply about the concrete implementation.
I added description here below link
https://stackoverflow.com/questions/51481575/web-apps-in-webview-android