Home Reference Source Test Repository
import View from 'trek/src/View.js'
public class | source

View

Initialize a new View with the given name

Constructor Summary

Public Constructor
public

constructor(name: String, options: Object)

Member Summary

Public Members
public
public

engine: *

public

ext: *

public
public

name: *

public

root: *

Method Summary

Public Methods
public
Lazy fetch the file path
public

* lookup(name: String): String

Lookup view by the given `name`
public

* render(options: Object): String

Render with the given options
public

* resolve(dir: String, file: String): String

Resolve the file within the given directory

Public Constructors

public constructor(name: String, options: Object) source

Params:

NameTypeAttributeDescription
name String
options Object
options.defaultEngine String

The default template engine name

options.engines Object

Template engine require() cache

options.root String

The Root path for view lookup

Public Members

public defaultEngine: * source

public engine: * source

public ext: * source

public fileName: * source

public name: * source

public root: * source

Public Methods

public * fetchPath(): string source

Lazy fetch the file path

Return:

string

The file path

public * lookup(name: String): String source

Lookup view by the given name

Params:

NameTypeAttributeDescription
name String

The file name

Return:

String

The file path

public * render(options: Object): String source

Render with the given options

Params:

NameTypeAttributeDescription
options Object

Return:

String

The rendered template string

public * resolve(dir: String, file: String): String source

Resolve the file within the given directory

Params:

NameTypeAttributeDescription
dir String
file String

Return:

String

The resolved file path