开发者

See source of JavaScriptObject in GWT?

开发者 https://www.devze.com 2023-03-28 03:47 出处:网络
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社区

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消