I have a JavaScriptObject that I'd like to see the code for so I can debug it. How can I do this?
I'd like to be able to do something like:开发者_StackOverflow社区
// in a callback
public void onSuccess(JavaScriptObject result) {
System.out.println("got - " + result.getData());
}
// prints: got - [1, 2, 3, {"foo": "bar}]
Is this possible?
JavaScriptObject has a .toString() method in the javadoc that says
Makes a best-effort attempt to get a useful debugging string describing the given JavaScriptObject.
If that does not help you, perhaps you can use JavaScript Overlay Types to create a thin wrapper on your JavaScriptObject to define a method such as getData()
to fulfill your requirements. You can directly access JSON fields that you know exists by using this
in an overlay.
精彩评论