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

# LazyBundleEntry

APISummary
Through [lazy loading components](/next/react/code-splitting.md#lazy-loading-components), developers can render on demand, thereby improving user experience. `LazyBundleEntry` is used to record the performance data of lazy loading components and inherits from [`PerformanceEntry`](/next/api/lynx-api/performance-api/performance-entry.md).

## Example

This example demonstrates how to obtain a `LazyBundleEntry`.

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

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

```tsx {17-22,31-33}
import { lazy, root, Suspense, useState } from "@lynx-js/react";
import type { LazyBundleEntry, PerformanceEntry } from "@lynx-js/types";
import { useEffect } from "react";
import { ScrollItem } from "../common/scroll-item/index.jsx";
import "./index.scss";

const MyLazyBundle = lazy(() => import("./MyLazyBundle.jsx"));

export default function LazyBundleEntryExample() {
  const [lazyBundleEntry, setLazyBundleEntry] = useState("");
  const [entryName, setEntryName] = useState("Waiting...");

  useEffect(() => {
    "background-only";
    // 1. Create a performance observer.
    const observer = lynx.performance.createObserver((entry: PerformanceEntry) => {
      if (entry.entryType == "resource") {
        // 3. Received "resource.lazyBundleEntry" event.
        const lazyBundleEntry = entry as LazyBundleEntry;
        setLazyBundleEntry(JSON.stringify(lazyBundleEntry, null, 4));
        setEntryName("LazyBundleEntry");
      }
    });
    // 2. Register to listen to the "resource" event.
    observer.observe(["resource"]);
  }, []);

  return (
    <view className="container">
      <text className="title">Hello LazyBundleEntry~</text>
      <Suspense fallback={<text className="sub-text">Loading...</text>}>
        <MyLazyBundle />
      </Suspense>
      <ScrollItem title={entryName} value={lazyBundleEntry} />
    </view>
  );
}

root.render(<LazyBundleEntryExample />);

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 the performance event; the value for all instances of this class is fixed as `resource`.

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

```ts
name: string;
```

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

### componentUrl

```tsx
componentUrl: string;
```

The URL string used to load the lazy loading component.

### size

```tsx
size: number;
```

The resource size of the lazy loading component, in bytes.

### mode

```tsx
mode: string;
```

The mode for loading the lazy loading component, with values: `preload` or `normal`.

### sync

```tsx
sync: boolean;
```

Whether the lazy loading component is rendered synchronously.

### loadSuccess

```tsx
loadSuccess: boolean;
```

Whether the lazy loading component was loaded successfully.

### requireStart

```tsx
requireStart: number;
```

The start timestamp for downloading the lazy loading component.This timestamp is a floating-point Unix timestamp (in milliseconds).

### requireEnd

```tsx
requireEnd: number;
```

The end timestamp for downloading the lazy loading component.This timestamp is a floating-point Unix timestamp (in milliseconds).

### decodeStart

```tsx
decodeStart: number;
```

The start timestamp for decoding the lazy loading component.This timestamp is a floating-point Unix timestamp (in milliseconds).

### decodeEnd

```tsx
decodeEnd: number;
```

The end timestamp for decoding the lazy loading component.This timestamp is a floating-point Unix timestamp (in milliseconds).

## Compatibility

**Compatibility Table**

**Query:** `lynx-api.performance-api.performance-entry.lazy-bundle-entry`

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

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

