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

# fromTemplateAsyncWithOption

APISummary
在提供选项的情况下，基于模板二进制数据异步创建一个 TemplateBundle。该方法可避免阻塞主线程。

## 语法

### Harmony

```typescript
public static async fromTemplateAsyncWithOption(template: ArrayBuffer, option: TemplateBundleOption): Promise<TemplateBundle>;
```

#### 参数说明

- `template`：模板二进制内容。
- `option`：`TemplateBundleOption` 对象。

#### 返回值

- 返回一个 `Promise`，resolve 后得到新的 `TemplateBundle` 对象。

:::note

- 由于 ArkTS 限制只能在应用主线程运行，我们提供异步的 TemplateBundle 创建 API，以减少主线程 I/O 操作带来的阻塞时间。在其他平台上，开发者可以自行选择在后台线程运行，无需专门的异步 API。

:::

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.template-bundle.from-template-async-with-option`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/template-bundle/from-template-async-with-option.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| from-template-async-with-option | No | Yes (3.6) | No | No | No | No |

**`from-template-async-with-option`**

Asynchronously creates a TemplateBundle from a template binary data with options. This method avoids blocking the main thread.

**Specifications:**

