大网数据广告活动
Web 标准与前端开发

InteractionContentfulPaint: largestContentfulPaint property

· 52CE 我爱测

The **`largestContentfulPaint`** read-only property of the PerformanceSoftNavigation interface returns the current largest LargestContentfulPaint relevant to this soft navigation.

Performance API

The largestContentfulPaint read-only property of the PerformanceSoftNavigation interface returns the current largest LargestContentfulPaint relevant to this soft navigation.

This can remain the same between two InteractionContentfulPaint entries for the same interaction if a new contentful paint is smaller than the current largest contentful paint for that interaction. When using this API to measure Largest Contentful Paint for soft navigations you may only be interested in the largest paint.

Note that, in current implementations, InteractionContentfulPaint is scoped to increasing paint sizes, so it can be used to measure Largest Contentful Paint for Soft Navigation; the largestContentfulPaint value should change each time. However, the API has been designed to allow for all paints relevant to an interaction to be emitted, so this is liable to change.

Value

A LargestContentfulPaint object representing the largest contentful paint (LCP) for this interaction contentful paint.

Examples

Logging the largest contentful paint of InteractionContentfulPaint

In this example, calling entry.largestContentfulPaint returns a LargestContentfulPaint object.

const observer = new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    console.log(
      "Interaction Contentful Paint:",
      entry.startTime,
      entry.largestContentfulPaint,
    );
  }
});
observer.observe({ type: "interaction-contentful-paint", buffered: true });

To get a JSON string, you can use JSON.stringify(entry) directly; it will call toJSON() automatically.

Specifications

Browser compatibility

See also

  • LargestContentfulPaint

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。