TypeDoc all the thngs
This commit is contained in:
@@ -3,6 +3,9 @@ import {Config} from "../service/Config"
|
||||
import {Container} from "@extollo/di"
|
||||
import {UniversalPath} from "@extollo/util"
|
||||
|
||||
/**
|
||||
* Abstract base class for rendering views via different view engines.
|
||||
*/
|
||||
export abstract class ViewEngine extends AppClass {
|
||||
protected readonly config: Config
|
||||
protected readonly debug: boolean
|
||||
@@ -14,10 +17,24 @@ export abstract class ViewEngine extends AppClass {
|
||||
|| this.config.get('server.debug', false))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UniversalPath to the base directory where views are loaded from.
|
||||
*/
|
||||
public get path(): UniversalPath {
|
||||
return this.app().appPath(...['resources', 'views']) // FIXME allow configuring
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a template string and a set of variables for the view, render the string to HTML and return it.
|
||||
* @param templateString
|
||||
* @param locals
|
||||
*/
|
||||
public abstract renderString(templateString: string, locals: {[key: string]: any}): string | Promise<string>
|
||||
|
||||
/**
|
||||
* Given the canonical name of a template file, render the file using the provided variables.
|
||||
* @param templateName
|
||||
* @param locals
|
||||
*/
|
||||
public abstract renderByName(templateName: string, locals: {[key: string]: any}): string | Promise<string>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user