Lynx

Template

本页面介绍 Lynx DevTool 支持的 Template CDP domain。

实验性参考

此生成的参考文档仍在完善中。

  • CDP events 尚未包含。
  • 部分 Lynx 扩展已列出,但尚未提供详细文档。
  • 方法说明尚未根据实现自动校验,可能不完整或不准确。

在依赖本参考前,请根据实现及所链接的 upstream CDP reference 验证实际行为。

概览

  • 作用域:instance
  • CDP domain:Lynx 专有

Lynx 扩展

Template.getTemplateJs

Returns a base64-encoded slice of saved template binary bytes.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_template_agent.cc
参数
NameTypeRequiredDescription
offsetintegerYesByte offset into the saved template binary. Constraints: minimum 0.
sizeintegerYesMaximum number of bytes to read. Platform implementations may clamp this value to the available template length. Constraints: minimum 0.
返回字段
NameTypeDescription
datastringBase64-encoded template bytes for the requested range. Empty when no template bytes are available, offset is outside the saved template, or the platform delegate is unavailable.
备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • params.offset and params.size are required. If either field is missing, the method returns a CDP error with message Params must have offset and size properties.
  • The native executor reads offset and size as unsigned integers; callers should pass non-negative integers.
  • Android returns a base64 slice from the saved binary template data or the bytes captured after a URL template load. The slice length is clamped to the remaining template bytes.
  • The generic embedder implementation returns an empty data string.
示例

Read a template byte range

Request:

{
  "id": 1,
  "method": "Template.getTemplateJs",
  "params": {
    "offset": 0,
    "size": 4096
  }
}

Response:

{
  "id": 1,
  "result": {
    "data": "AAECAw=="
  }
}

Template.templateApi

Reports template data processor API information for the current template.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_template_agent.cc
参数

无参数。

返回字段
NameTypeDescription
useDefaultbooleanWhether the current template has a default data processor closure.
processMapKeysarrayNames of registered data processor entries. This field is omitted when the processor map is empty.
备注
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • When TASM is unavailable, the result reports useDefault as false.
示例

Get template processor API info

Request:

{
  "id": 1,
  "method": "Template.templateApi"
}

Response:

{
  "id": 1,
  "result": {
    "useDefault": true,
    "processMapKeys": ["main"]
  }
}

Template.templateConfigInfo

Compatibility method for removed template config info support.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_template_agent.cc
参数

无参数。

返回字段
NameTypeDescription
resultstringAlways an empty string.
备注
  • This method does not call the mediator or platform facade.
  • The response result is an empty string, not an object, because config info support was removed.
示例

Get removed template config info

Request:

{
  "id": 1,
  "method": "Template.templateConfigInfo"
}

Response:

{
  "id": 1,
  "result": ""
}

Template.templateData

Returns the current initial template data exposed by the platform facade.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_template_agent.cc
参数

无参数。

返回字段
NameTypeDescription
contentstringSerialized template data produced from the platform Lepus value. This field is present only when the platform facade returns a non-null template data value.
备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • Android reads the saved initial TemplateData pointer from the platform reload helper; Darwin delegates to the platform implementation.
  • If the platform facade has no template data value, the result object is returned without content.
示例

Get current template data

Request:

{
  "id": 1,
  "method": "Template.templateData"
}

Response:

{
  "id": 1,
  "result": {
    "content": "{\"title\":\"hello\"}"
  }
}
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。