For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/lynx-native-api/lynx-load-meta.md.
Lynx
  • English
  • LynxLoadMeta

    LynxLoadMeta is the metadata structure used by LynxView to load templates. It will be used as the input parameter of loadTemplate. Users can use LynxLoadMeta to specify many parameters of loading templates, such as specifying template content, template initial data, and other additional configuration information;

    Android:

    Field

    • url: String : Template file path;
    • binaryData: byte[]: The binary file data of the template;
    • bundle: TemplateBundle: TemplateBundle object parsed in advance by the template's binary file data;
    • initialData: TemplateData: Initial data specified by the client during the first screen loading process;
    • globalProps: TemplateData: Global properties, which will be synchronized to the template after the template is loaded.
    • loadMode: LynxLoadMode: Loading mode, the default value is LynxLoadMode.NORMAL.
    • loadOptions: EnumSet<LynxLoadOption>: Additional configuration information when loading templates;
    • lynxViewConfig: Map<String, String>: Page Config information passed in when loading the template.
    Info

    url, binaryData, bundle are the required parameters for template loading. You can pass only one or all of them. The priority relationship is as follows: bundle > binaryData > url

    Info

    loadOptions is additional configuration information when loading a template. Currently the following configuration items are supported:

    • RECYCLE_TEMPLATE_BUNDLE: After LynxView uses url or binaryData to load the template, it supports returning a TemplateBundle to the calling business party through LynxViewClient;
    • DUMP_ELEMENT: When LynxView loads a Bundle, copy the ElementBundle to the TemplateBundle and pass it back through the LynxViewClient;
    Info

    loadMode is the loading mode of the template. Currently, the following configuration items are supported:

    • NORMAL: Default loading mode.
    • PRE_PAINTING: Suspend JS events when loading the template. Events will be sent during update, and layout will be blocked until the update is complete.
    • PRE_PAINTING_DRAW: Suspend JS events when loading the template. Events will be sent during update.

    Construction

    To construct a LynxLoadMeta object on the Android platform, you need to use LynxLoadMeta.Builder:

    LynxLoadMeta.Builder builder = new LynxLoadMeta.Builder();
    builder.setUrl();
    builder.setBinaryData();
    builder.setTemplateBundle();
    builder.setInitialData();
    builder.setGlobalProps();
    builder.setLoadMode();
    builder.addLoadOption();
    builder.setLynxViewConfig();
    LynxLoadMeta meta = builder.build();

    iOS

    Field

    • url: NSString*: Template file path;
    • binaryData: NSData*: The binary file data of the template;
    • templateBundle: LynxTemplateBundle*: TemplateBundle object parsed in advance by the template's binary file data;
    • initialData: LynxTemplateData*: Initial data specified by the client during the first screen loading process;
    • globalProps: LynxTemplateData*: Global properties, which will be synchronized to the template after the template is loaded.
    • loadMode: LynxLoadMode: Loading mode, the default value is LynxLoadModeNormal.
    • loadOption: LynxLoadOption: Additional configuration information when loading templates;
    • lynxViewConfig: NSMutableDictionary<NSString*, id>*: Page Config information passed in when loading the template.
    Info

    url, binaryData, templateBundle are the required parameters for template loading. You can pass only one or all of them. The priority relationship is as follows: templateBundle > binaryData > url

    Info

    loadOption is additional configuration information when loading a template. Currently the following configuration items are supported:

    • RECYCLE_TEMPLATE_BUNDLE: After LynxView uses url or binaryData to load the template, it supports returning a TemplateBundle to the calling business party through LynxViewClient;
    • DUMP_ELEMENT: When LynxView loads a Bundle , copy the ElementBundle to the TemplateBundle and pass it back through the LynxViewClient;
    Info

    loadMode is the loading mode of the template. Currently, the following configuration items are supported:

    • LynxLoadModeNormal: Default loading mode.
    • LynxLoadModePrePainting: Suspend JS events when loading the template. Events will be sent during update, and layout will be blocked until the update is complete.

    Construction

    On the iOS platform, you can construct a LynxLoadMeta object as follows:

    LynxLoadMeta* meta = [LynxLoadMeta init];
    meta.url = @"";
    meta.binaryData = nil;
    meta.templateBundle = nil;
    meta.initialData = nil;
    meta.globalProps = nil;
    meta.loadMode = LynxLoadModeNormal;
    meta.loadOption = LynxLoadOptionDumpElement | LynxLoadOptionRecycleTemplateBundle;
    meta.lynxViewConfig = nil;

    Desktop (C++)

    Construct LynxLoadMeta with the default constructor and configure it through setters:

    auto meta = std::make_shared<lynx::pub::LynxLoadMeta>();
    meta->SetUrl(url);
    meta->SetBinaryData(bytes);
    meta->SetTemplateBundle(bundle);
    meta->SetInitialData(initial_data);
    meta->SetGlobalProps(global_props);

    Desktop public API follows the same precedence for template source selection:

    template_bundle > binary_data > url

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.