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/cdp-result-callback.md.
Lynx
  • 简体中文
  • CDPResultCallback

    用于接收 invokeCDPFromSDK 异步返回结果的回调。

    语法

    iOS

    LynxBaseInspectorOwner.h
    typedef void (^CDPResultCallback)(NSString *result);

    Android

    CDPResultCallback.java
    public interface CDPResultCallback {
      void onResult(String result);
    }

    参数说明

    • result: 包含 CDP Method 返回结果的 JSON 字符串。

    返回数据格式

    JSON 格式的字符串。

    字段类型说明
    idnumber消息 ID,与 invokeCDPFromSDK 中传入的值一致
    resultobjectMethod 返回值,请参考 CDP

    例如,DOM.getDocument 的返回数据如下:

    {
      "id" : 1,
      "result" : {
        "root" : {
          "attributes" : [],
          "backendNodeId" : 11,
          "childNodeCount" : 1,
          "children" : [
             ...
          ],
          "localName" : "",
          "nodeId" : 11,
          "nodeName" : "#document",
          "nodeType" : 9,
          "nodeValue" : ""
       }
    }

    使用示例

    请参考 invokeCDPFromSDK

    兼容性

    LCD tables only load in the browser

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