For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/lynx-devtool-native-api/lynx-base-inspector-owner/get-console-object.md.
Lynx
  • 简体中文
  • getConsoleObject

    对于 Object 类型的 console 消息,可使用此方法获取其详细信息。

    关于如何获取这类数据,请参考 LynxInspectorConsoleDelegate

    语法

    iOS

    LynxBaseInspectorOwner.h
    - (void)getConsoleObject:(NSString *_Nonnull)objectId
               needStringify:(BOOL)stringify
               resultHandler:(void (^_Nonnull)(NSString *_Nonnull detail))handler;

    Android

    LynxBaseInspectorOwner.java
    void getConsoleObject(String objectId, boolean needStringify, Callback callback);

    Harmony

    LynxBaseInspectorOwner.ets
    getConsoleObject(objectId: string, needStringify: boolean, callback: (detail: string) => void): void;

    参数说明

    • objectId: 要获取的 Object 的唯一标识符。请参考 objectId
    • stringify / needStringify: 是否需要将该 Object 序列化为字符串。
      • true 时,效果等同于调用 JSON.stringify 方法。
      • false 时,仅返回该 Object 的第一层属性(非递归)。如果属性值本身也是一个 Object,则仅返回其基本信息,你需要使用新的 objectId 再次调用此方法来获取其内部属性。
    • handler / callback: 获取结果的回调,只有一个 String 类型的参数。

    数据格式

    所有数据均为 JSON 格式的字符串。

    • needStringifytrue: 返回该 Object 完整序列化后的 JSON 字符串。

    • needStringifyfalse: 返回该 Object 的第一层属性(非递归)。数组类型,每个元素的格式如下:

      字段类型说明
      namestring属性名称
      valueargument属性值

    示例

    请参考 LynxInspectorConsoleDelegate

    使用示例

    请参考 LynxInspectorConsoleDelegate

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。