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-api/performance-api/performance-entry/metric-fcp-entry.md.
Lynx
  • 简体中文
  • deprecated MetricFcpEntry

    Warning

    该事件在 Lynx SDK 3.7 版本已废弃,相关数据可从 LoadBundleEntry / ReloadBundleEntry 中获取.

    FCP 是衡量页面首次渲染完成所需时间的关键性能指标。它指的是用户第一次看到 Lynx 页面中任意内容(如文本、图片等)所需的时间。MetricFcpEntry 是用于描述该指标的数据类型,继承自 PerformanceEntry

    FCP 事件在 Lynx 绘制完页面第一帧时触发。对于依赖网络请求或异步 IO 获取数据的页面,FCP 通常监测到的状态是 Loading 页或框架图,如下图:

    根据不同起始点,Lynx 提供了 fcplynxFcptotalFcp 三个指标。在渲染流程中,每个指标的定义如下图:

    示例

    该示例展示了如何获取 MetricFcpEntry

    Lynx 在首帧渲染完成时计算 FCP。如果已经通过 LynxView.setExtraTiming 提供了容器时间戳,那么收到的 MetricFcpEntry 里会包含 fcplynxFcptotalFcp 三项指标。否则,MetricFcpEntry 只包含 lynxFcp。补充容器时间戳后,其余指标将被重新计算。重新计算完成后,Lynx 将发送一个新的包含所有指标的 MetricFcpEntry

    实例属性

    entryType

    entryType: string;

    性能事件的类型,当前类所有实例的值均固定为 metric

    name

    name: string;

    性能事件的具体名称,当前类所有实例的值均固定为 fcp

    fcp

    fcp?: PerformanceMetric;

    从准备 TemplateBundle 至首次渲染完成的耗时,数据类型为 PerformanceMetric

    计算公式为:fcp = LoadBundleEntry.paintEnd - InitContainerEntry.prepareTemplateStart

    lynxFcp

    lynxFcp: PerformanceMetric;

    从加载 TemplateBundle 至首次渲染完成的耗时,数据类型为 PerformanceMetric

    计算公式为:lynxFcp = LoadBundleEntry.paintEnd - LoadBundleEntry.loadBundleStart

    totalFcp

    totalFcp?: PerformanceMetric;

    从用户打开页面至首次渲染完成的耗时,数据类型为 PerformanceMetric

    计算公式为:totalFcp = LoadBundleEntry.paintEnd - InitContainerEntry.openTime

    兼容性

    LCD tables only load in the browser

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