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
参数
返回字段
备注
- 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:
Response:
Non-component fallback
Request:
Response:
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
参数
返回字段
备注
- 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:
Response:
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
参数
返回字段
备注
- 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:
Response:
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
参数
无参数。
返回字段
备注
- 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:
Response:
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:
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
参数
无参数。
返回字段
备注
- 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:
Response:
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
参数
无参数。
返回字段
备注
- 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:
Response:
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
参数
返回字段
无返回字段。
备注
- 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:
Response:
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:
Response:
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
参数
返回字段
无返回字段。
备注
- 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: