Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Templator

Template class based on handlebars
模版工具类

Example:
let te = new Templator(), array = [];
for (let i = 0; i < 100000; i++) {
    array[i] = { val: i + 1 };
}
let text = te.compile('{{#.}}Number: {{val}}\n{{/.}}')(array);
//Note: Need load the 'handlebars' library.
JS.imports('$handlebars').then({
});

//Note: Need load the 'handlebars' runtime before using compiled files.
JS.imports('$handlebars-runtime').then({
});

Hierarchy

  • Templator

Index

Constructors

constructor

Methods

compile

registerHelper

unregisterHelper

  • unregisterHelper(name: string): void
  • Parameters

    • name: string

    Returns void

Static safeString

  • safeString(s: string): any
  • Parameters

    • s: string

    Returns any