Lynx

Lynx

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

实验性参考

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

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

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

概览

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

Lynx 扩展

Lynx.getComponentId

Returns the Lynx component id associated with a DevTool node id.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_lynx_agent_ng.cc
参数
NameTypeRequiredDescription
nodeIdintegerYesDevTool node id to resolve in the current Lynx element tree.
返回字段
NameTypeDescription
componentIdstring|integerComponent id string for component nodes. The value is the integer -1 when the node is missing or is not a component node.
备注
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • The handler resolves params.nodeId and reads ComponentElement::component_id() only for component elements.
  • The response uses mixed value types today. Component ids are strings, while the fallback value is the integer -1.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
示例

Resolve a component node id

Request:

{
  "id": 1,
  "method": "Lynx.getComponentId",
  "params": {
    "nodeId": 42
  }
}

Response:

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

Non-component fallback

Request:

{
  "id": 2,
  "method": "Lynx.getComponentId",
  "params": {
    "nodeId": 7
  }
}

Response:

{
  "id": 2,
  "result": {
    "componentId": -1
  }
}

Lynx.getData

Returns the serialized data string for a Lynx component node.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_lynx_agent_ng.cc
参数
NameTypeRequiredDescription
nodeIdintegerYesDevTool node id to resolve in the current Lynx element tree.
返回字段
NameTypeDescription
datastringSerialized component data. Empty string when the node is missing, is not a component node, or the component data helper has no data.
备注
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • The handler only calls the component data helper when params.nodeId resolves to a component element.
  • The current native component data helper returns an empty string.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
示例

Read component data

Request:

{
  "id": 1,
  "method": "Lynx.getData",
  "params": {
    "nodeId": 42
  }
}

Response:

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

Lynx.getProperties

Returns the serialized properties string for a Lynx component node.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_lynx_agent_ng.cc
参数
NameTypeRequiredDescription
nodeIdintegerYesDevTool node id to resolve in the current Lynx element tree.
返回字段
NameTypeDescription
propertiesstringSerialized component properties. Empty string when the node is missing, is not a component node, or the component properties helper has no data.
备注
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • The handler only calls the component properties helper when params.nodeId resolves to a component element.
  • The current native component properties helper returns an empty string.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
示例

Read component properties

Request:

{
  "id": 1,
  "method": "Lynx.getProperties",
  "params": {
    "nodeId": 42
  }
}

Response:

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

Lynx.getRectToWindow

Returns the LynxView rectangle relative to the containing window.

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

无参数。

返回字段
NameTypeDescription
leftnumberLeft coordinate of the LynxView rectangle.
topnumberTop coordinate of the LynxView rectangle.
widthnumberWidth of the LynxView rectangle.
heightnumberHeight of the LynxView rectangle.
备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • The result is the four-value vector returned by the platform facade as left, top, width, and height.
  • Android reads the root UI rect from UITreeHelper. Darwin reads the root UI rect and multiplies it by the screen scale.
  • The native implementation does not read request params.
  • If the mediator has no UI task runner or the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Read the LynxView window rectangle

Request:

{
  "id": 1,
  "method": "Lynx.getRectToWindow"
}

Response:

{
  "id": 1,
  "result": {
    "left": 0,
    "top": 0,
    "width": 390,
    "height": 844
  }
}

Lynx.getScreenshot

Requests the platform to send a Lynx screenshot or card preview.

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

无参数。

返回字段

无返回字段。

备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • The handler calls DevToolPlatformFacade::GetLynxScreenShot().
  • Android and Darwin delegate this to their sendCardPreview platform hook.
  • The current native handler does not send a CDP response after invoking the platform hook.
  • The native implementation does not read request params.
  • If the mediator has no UI task runner or the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Request a Lynx screenshot

Request:

{
  "id": 1,
  "method": "Lynx.getScreenshot"
}

Lynx.getVersion

Returns the Lynx engine version string reported by the platform.

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

无参数。

返回字段
NameTypeDescription
resultstringLynx version string returned directly as the CDP result value.
备注
  • Dispatches through LynxDevToolMediator to InspectorDefaultExecutor on the DevTool thread.
  • The response result is a string value, not an object wrapper.
  • Android delegates to DevToolPlatformAndroidDelegate.getLynxVersion(). Darwin delegates to LynxDeviceInfoHelper.getLynxVersion().
  • The native implementation does not read request params.
  • If the mediator has no DevTool task runner or the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Read the Lynx version

Request:

{
  "id": 1,
  "method": "Lynx.getVersion"
}

Response:

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

Lynx.getViewLocationOnScreen

Returns the LynxView top-left location on the screen.

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

无参数。

返回字段
NameTypeDescription
xintegerPlatform-provided x coordinate for the LynxView on screen, or -1 when unavailable.
yintegerPlatform-provided y coordinate for the LynxView on screen, or -1 when unavailable.
备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • The handler returns x and y from DevToolPlatformFacade::GetViewLocationOnScreen().
  • Android reads the LynxView location on screen and divides the stored coordinates by display density. Darwin returns the root view point converted to screen coordinates.
  • If the platform facade returns fewer than two coordinates, the response uses x = -1 and y = -1.
  • The native implementation does not read request params.
  • If the mediator has no UI task runner or the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Read the LynxView screen location

Request:

{
  "id": 1,
  "method": "Lynx.getViewLocationOnScreen"
}

Response:

{
  "id": 1,
  "result": {
    "x": 12,
    "y": 48
  }
}

Lynx.sendVMEvent

Sends a DevTool-originated event to a Lynx VM target.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_lynx_agent_ng.cc
参数
NameTypeRequiredDescription
vmTypestringYesVM target string passed to the platform facade.
eventstringYesEvent name passed to the VM.
datastringNoString payload passed with the event. Non-string values are treated as an empty string by the native handler.
返回字段

无返回字段。

备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • The handler forwards the event only when params.vmType and params.event are strings.
  • Darwin wraps the payload with origin Devtool and target set to params.vmType before calling the platform delegate.
  • The handler returns an empty CDP result object after processing the request, including requests with missing or invalid params.
  • If params are valid but the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Send a VM event

Request:

{
  "id": 1,
  "method": "Lynx.sendVMEvent",
  "params": {
    "vmType": "main",
    "event": "DevToolRefresh",
    "data": "{\"reason\":\"manual\"}"
  }
}

Response:

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

Lynx.setTraceMode

Deprecated trace-mode method that currently returns a method-not-found error.

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

无参数。

返回字段

无返回字段。

备注
  • Dispatches through LynxDevToolMediator to InspectorDefaultExecutor on the DevTool thread.
  • The native handler no longer supports this method and does not read request params.
  • The response is a CDP error with JSON-RPC code -32601 and message SetTraceMode is deprecated. Use global messages.
  • If the mediator has no DevTool task runner, the current handler does not send an explicit CDP response.
示例

Deprecated trace mode request

Request:

{
  "id": 1,
  "method": "Lynx.setTraceMode"
}

Response:

{
  "id": 1,
  "error": {
    "code": -32601,
    "message": "SetTraceMode is deprecated. Use global messages."
  }
}

Lynx.transferData

Transfers a template data fragment to the platform reload helper.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_lynx_agent_ng.cc
参数
NameTypeRequiredDescription
dataTypestring (template)YesData category. The native handler only processes the value template.
datastringYesTemplate fragment data to pass to the platform facade.
eofbooleanYesWhether this fragment is the final template fragment.
返回字段

无返回字段。

备注
  • Dispatches through LynxDevToolMediator to InspectorUIExecutor on the UI thread.
  • The handler forwards data only when params.dataType is template, params.data is a string, and params.eof is a boolean.
  • Matching requests call DevToolPlatformFacade::OnReceiveTemplateFragment(data, eof).
  • Missing params, unsupported dataType values, or invalid field types are ignored.
  • The current native handler does not send a CDP response.
  • If the mediator has no UI task runner or the platform facade is unavailable, the current handler does not send an explicit CDP response.
示例

Transfer a template fragment

Request:

{
  "id": 1,
  "method": "Lynx.transferData",
  "params": {
    "dataType": "template",
    "data": "<binary-or-encoded-template-fragment>",
    "eof": false
  }
}
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。