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

PerformanceSoftNavigation: getLargestInteractionContentfulPaint() method

· 52CE 我爱测

The **`getLargestInteractionContentfulPaint()`** method of the PerformanceSoftNavigation interface returns the current largest InteractionContentfulPaint relevant to this soft navigation.

Performance API

The getLargestInteractionContentfulPaint() method of the PerformanceSoftNavigation interface returns the current largest InteractionContentfulPaint relevant to this soft navigation.

Some SPA may paint first and update the URL afterwards. Despite this, developers will want to include these paints when measuring Largest contentful paint for Soft navigation. Because interaction with any paints could also lead to a URL update and thus a soft navigation at any point in the future, this could be difficult to measure without potentially saving a temporary reference to every interaction's LCP, should it be needed.

The getLargestInteractionContentfulPaint() method avoids developers having to do that by providing a means to get the latest, largest InteractionContentfulPaint for the soft navigation.

It is defined as a method rather than a static property because it returns the latest, largest entry, and therefore may return different results over time if increasing InteractionContentfulPaint entries are recorded after the soft navigation.

Syntax

getLargestInteractionContentfulPaint()

Parameters

None.

Return value

An InteractionContentfulPaint object representing the largest InteractionContentfulPaint for this soft navigation.

Examples

Using the getLargestInteractionContentfulPaint method

In this example, calling entry.getLargestInteractionContentfulPaint() returns a JSON representation of the LargestContentfulPaint object.

const observer = new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    console.log(
      "Soft Nav:",
      entry.startTime,
      entry.getLargestInteractionContentfulPaint(),
    );
  }
});
observer.observe({ type: "soft-navigation", buffered: true });

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

Specifications

Browser compatibility

See also

  • InteractionContentfulPaint

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

资料来源与适用范围

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

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

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