TemplateBundle

TemplateBundle is the output product of the PreDecode capability provided by the Lynx SDK. Client developers can parse the Lynx template product in advance to obtain the TemplateBundle object and consume the template product.

Android

fromTemplate

public static TemplateBundle fromTemplate(byte[] template)

Input Lynx template binary content and return the parsed TemplateBundle object.

Params:

  • template: byte[]: Template binary content;

Note:

  • When the input template is null, this method returns null directly;
  • When the input template is not a correct Lynx template data, an invalid TemplateBundle is returned;

getExtraInfo

public Map<String, Object> getExtraInfo()

Read the content of the extraInfo field configured in the pageConfig of the front-end template. When the front-end does not configure extraInfo or is called on an empty TemplateBundle object, it returns null;

isValid

public boolean isValid()

Determines whether the current TemplateBundle object is valid.

getErrorMessage

public String getErrorMessage()

When TemplateBundle is an invalid object, use this method to obtain the exception information that occurred during template parsing;

postJsCacheGenerationTask

public void postJsCacheGenerationTask(String codeCacheSourceUrl, boolean useV8)

Start a sub-thread task to generate the js code cache of the current template;

Params:

  • codeCacheSourceUrl: String: The url of the current template;
  • useV8: boolean: Whether to generate V8 Code Cache, otherwise generate QuickJS Code Cache;

release

public void release();

Release the Native memory held by the current TemplateBundle object. After executing the release method, the TemplateBundle will become the inValid state;

iOS

initWithTemplate

- (instancetype _Nullable)initWithTemplate:(nonnull NSData*)tem;

Input Lynx template binary content and return the parsed LynxTemplateBundle object.

Params:

  • tem: NSData*: Template binary content;

Note:

  • When the input tem is not a correct Lynx template data, or is nil, an invalid TemplateBundle is returned;

errorMsg

- (NSString* _Nullable)errorMsg;

Use this method to obtain the exception information that occurs during template parsing; if nil is returned, it proves that the LynxTemplateBundle is normal;

extraInfo

- (NSDictionary* _Nullable)extraInfo;

Read the content of the extraInfo field configured in the pageConfig of the front-end template. When the front-end does not configure extraInfo or is called on an empty TemplateBundle object, it returns null;

Compatibility

LCD tables only load in the browser

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.