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, and this page is available as Markdown at /next/zh/api/lynx-native-api/template-bundle/from-template-async-with-option.md.
Lynx
  • 简体中文
  • fromTemplateAsyncWithOption

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

    语法

    Harmony

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

    参数说明

    • template:模板二进制内容。
    • optionTemplateBundleOption 对象。

    返回值

    • 返回一个 Promise,resolve 后得到新的 TemplateBundle 对象。
    Note
    • 由于 ArkTS 限制只能在应用主线程运行,我们提供异步的 TemplateBundle 创建 API,以减少主线程 I/O 操作带来的阻塞时间。在其他平台上,开发者可以自行选择在后台线程运行,无需专门的异步 API。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。