> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# deprecated MetricFcpEntry

:::warning
This event has been deprecated since Lynx SDK 3.7. Related data can be obtained from [`LoadBundleEntry`](/next/api/lynx-api/performance-api/performance-entry/load-bundle-entry.md) / [`ReloadBundleEntry`](/next/api/lynx-api/performance-api/performance-entry/reload-bundle-entry.md).
:::

APISummary
FCP is a key performance metric that measures the time taken for the [first-frame rendering](/next/guide/spec.md#first-frame-rendering) of lynx app to complete. It refers to the time taken for users to see any content (such as text or images) on a lynx app for the first time. `MetricFcpEntry` interface provides timing information about this metric, inheriting from [`PerformanceEntry`](/next/api/lynx-api/performance-api/performance-entry.md).

The FCP event is triggered when Lynx completes the rendering of the first frame of the lynx app. For lynx apps that rely on network requests or asynchronous I/O to fetch data, the typical state monitored at FCP is the loading page or a placeholder, as shown in the diagram below:

![](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/performance-metrics-fcp.png)
Depending on different starting points, Lynx provides three metrics: `fcp`, `lynxFcp`, and `totalFcp`. Each metric's definition in the rendering process is illustrated in the diagram below:

![](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/metric-fcp-entry.png)
## Example

This example demonstrates how to obtain a `MetricFcpEntry`.

Lynx calculates the FCP upon completion of the first frame rendering. If you have provided container-related timestamps using [LynxView.setExtraTiming](/next/api/lynx-native-api/lynx-view/set-extra-timing.md), the `MetricFcpEntry` includes `fcp`, `lynxFcp`, and `totalFcp`. Otherwise, the `MetricFcpEntry` only contains `lynxFcp`. After supplementing the [container](/next/guide/spec.md#container) timestamp, the remaining metrics will be recalculated. Once recalculation is complete, Lynx will send a new `MetricFcpEntry` containing all the metrics.

**This is an example below: performance-api**

**Entry:** `src/fcp-entry`
**Bundle:** `dist/fcp-entry.lynx.bundle`

```tsx {10-20}
import * as React from "@lynx-js/react";
import { root, useMemo, useState } from "@lynx-js/react";
import type { MetricFcpEntry, PerformanceEntry } from "@lynx-js/types";
import "./index.scss";

export default function MetricFcpEntryExample(this: any) {
  const [fcpEntry, setFcpEntry] = useState<string>("");

  useMemo(() => {
    "background-only";
    // 1. Create a performance observer.
    const observer = lynx.performance.createObserver((entry: PerformanceEntry) => {
      if (entry.entryType == "metric" && entry.name == "fcp") {
        // 3. Received "metric.fcp" event.
        const fcpEntry = entry as MetricFcpEntry;
        setFcpEntry(JSON.stringify(fcpEntry, null, 4));
      }
    });
    // 2. Register to listen to the "metric.fcp" event.
    observer.observe(["metric.fcp"]);
  }, []);

  return (
    <view className="container">
      <text className="title">Hello MetricFcpEntry~</text>
      <text className="entry">{fcpEntry}</text>
    </view>
  );
}

root.render(<MetricFcpEntryExample />);

if (import.meta.webpackHot) {
  import.meta.webpackHot.accept();
}

```

v0.8.0



## Instance Properties

### [entryType](/next/api/lynx-api/performance-api/performance-entry.md#entrytype)

```ts
entryType: string;
```

The type of performance event; the value for all instances of this class is fixed as `metric`.

### [name](/next/api/lynx-api/performance-api/performance-entry.md#name)

```ts
name: string;
```

The specific name of the performance event; the value for all instances of this class is fixed as `fcp`.

### fcp

```ts
fcp?: PerformanceMetric;
```

The time taken from preparing the [TemplateBundle](/next/api/lynx-native-api/template-bundle.md) to the completion of the first rendering, with a data type of [`PerformanceMetric`](/next/api/lynx-api/performance-api/performance-metric.md).

Calculation formula: `fcp = LoadBundleEntry.paintEnd - InitContainerEntry.prepareTemplateStart`.

### lynxFcp

```ts
lynxFcp: PerformanceMetric;
```

The time taken from loading the [TemplateBundle](/next/api/lynx-native-api/template-bundle.md) to the completion of the first rendering, with a data type of [`PerformanceMetric`](/next/api/lynx-api/performance-api/performance-metric.md).

Calculation formula: `lynxFcp = LoadBundleEntry.paintEnd - LoadBundleEntry.loadBundleStart`.

### totalFcp

```ts
totalFcp?: PerformanceMetric;
```

The time taken from the user opening the page to the completion of the first rendering, with a data type of [`PerformanceMetric`](/next/api/lynx-api/performance-api/performance-metric.md).

Calculation formula: `totalFcp = LoadBundleEntry.paintEnd - InitContainerEntry.openTime`.

## Compatibility

**Compatibility Table**

**Query:** `lynx-api.performance-api.performance-entry.metric-fcp-entry`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/performance-api/performance-entry/metric-fcp-entry.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| metric-fcp-entry | Yes (3.1) | Yes (3.4) | Yes (3.1) | Yes (3.7) | Yes (3.7) | No |

