> 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.

# deprecated InitBackgroundRuntimeEntry

:::warning
该事件在 Lynx SDK 3.7 版本已废弃，相关数据可从 [`LoadBundleEntry`](/next/zh/api/lynx-api/performance-api/performance-entry/load-bundle-entry.md) / [`ReloadBundleEntry`](/next/zh/api/lynx-api/performance-api/performance-entry/reload-bundle-entry.md) 中获取.
:::

APISummary
`InitBackgroundRuntimeEntry` 接口提供关于 [Background Thread Runtime](/next/zh/guide/spec.md#background-thread-runtime) 初始化的关键时间，它继承自 [`PerformanceEntry`](/next/zh/api/lynx-api/performance-api/performance-entry.md)。

在初始化流程中，指标的定义如下图：
![background thread runtime 初始化的关键时间](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/init-background-runtime-entry.png)

## 示例

该示例展示了如何获取 `InitBackgroundRuntimeEntry`。

**下面是一个示例: performance-api**

**Entry:** `src/init-background-runtime-entry`
**Bundle:** `dist/init-background-runtime-entry.lynx.bundle`

```tsx {11-23}
import * as React from "@lynx-js/react";
import { root, useMemo, useState } from "@lynx-js/react";
import type { InitBackgroundRuntimeEntry, PerformanceEntry } from "@lynx-js/types";

import "./index.css";

export default function InitBackgroundRuntimeEntryExample(this: any) {
  const [initBackgroundRuntimeEntry, setInitBackgroundRuntimeEntry] = useState<string>("");

  function observerPerformanceEntry() {
    "background-only";
    // 1. Create a performance observer.
    const observer = lynx.performance.createObserver((entry: PerformanceEntry) => {
      console.log(JSON.stringify(entry));
      if (entry.entryType == "init" && entry.name == "backgroundRuntime") {
        // 3. Received "init.backgroundRuntime" event.
        const initBackgroundRuntimeEntry = entry as InitBackgroundRuntimeEntry;
        setInitBackgroundRuntimeEntry(JSON.stringify(initBackgroundRuntimeEntry, null, 4));
        observer.disconnect();
      }
    });
    // 2. register to listen to the "init.backgroundRuntime" event.
    observer.observe(["init.backgroundRuntime"]);
  }

  useMemo(() => {
    observerPerformanceEntry();
  }, []);

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

root.render(<InitBackgroundRuntimeEntryExample />);

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

```

v0.8.0



## 实例属性

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

```tsx
entryType: string;
```

性能事件的类型，当前类所有实例的值均固定为 `init`。

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

```tsx
name: string;
```

性能事件的名称，当前类所有实例的值均固定为 `backgroundRuntime`。

### loadCoreStart

```tsx
loadCoreStart: number;
```

初始化[后台线程运行时](/next/zh/guide/spec.md#background-thread-runtime)环境的开始时间戳。该时间戳是一个表示为浮点型的 Unix 时间戳（单位：毫秒），精确到小数点后三位。例如：1739594612307.429。

### loadCoreEnd

```tsx
loadCoreEnd: number;
```

初始化[后台线程运行时](/next/zh/guide/spec.md#background-thread-runtime)环境的结束时间戳。该时间戳是一个表示为浮点型的 Unix 时间戳（单位：毫秒），精确到小数点后三位。例如：1739594612307.429。

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.performance-api.performance-entry.init-background-runtime-entry`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| init-background-runtime-entry | Yes (3.1) | Yes (3.4) | Yes (3.1) | Yes (3.7) | Yes (3.7) | No |

**`init-background-runtime-entry`**

Entry for background runtime initialization performance data.

