View

View Provides management and rendering of ejs templates including DOM diffing.

Constructor

new View(appInstance)

Constructor

Parameters:
NameTypeDescription
appInstanceApp

App reference

Methods

compile(template, opts) → {*}

Compiles template with given options

Parameters:
NameTypeDescription
templatestring

EJS based template

optsobject

EJS template options. @see https://ejs.co/#docs

Returns:
  • Compiled template function
Type: 
*

getHtml(tmpl, data, tmplOptions) → {string}

Generate HTML from given template string and data

Parameters:
NameTypeDefaultDescription
tmpl
data
tmplOptionsnull
Returns:
  • Generated HTML
Type: 
string

render(container, tmpl, dataopt, forceRepaintopt, tmplOptionsopt)

Renders template with given data to html container.

Parameters:
NameTypeAttributesDefaultDescription
containerHTMLElement | null

Container in which template should be rendered.

tmplstring

EJS template string

dataobject<optional>
{}

Template data.

forceRepaintboolean<optional>
false

If false, DOM diffing is enabled.

tmplOptionsobject<optional>
null

EJS template options. @see https://ejs.co/#docs

renderHtml(container, html)

Parameters:
NameTypeDescription
containerHTMLElement | null

Container in which template should be rendered.

htmlstring

HTML string to be rendered

setWindowTitle(title)

Sets window title

Parameters:
NameTypeDescription
titlestring

Title to set