Skip to main content

Class: ObjectLoader

A loader that uses an Object of strings to store template template source Text.

Extends

Constructors

new ObjectLoader()

new ObjectLoader(obj?): ObjectLoader

Parameters

obj?

Returns

ObjectLoader

Overrides

Loader.constructor

Defined in

src/builtin/loaders/object_loader.ts:10

Methods

getSource()

getSource(name): Promise<TemplateSource>

Override getSource to implement a custom loader.

Parameters

name: string

The name or identifier of a template.

Returns

Promise<TemplateSource>

The source, with any meta data, for the template identified by the given name

Throws

TemplateNotFoundError Thrown if the template can not be found.

Overrides

Loader.getSource

Defined in

src/builtin/loaders/object_loader.ts:15


getSourceSync()

getSourceSync(name): TemplateSource

A synchronous version of getSource.

Parameters

name: string

Returns

TemplateSource

See

getSource

Overrides

Loader.getSourceSync

Defined in

src/builtin/loaders/object_loader.ts:19


load()

load(name, environment, context?, globals?, loaderContext?): Promise<Template>

Used internally by Environment.getTemplate(). Delegates to getSource.

Parameters

name: string

environment: Environment

context?: RenderContext

globals?: ContextScope

loaderContext?

Returns

Promise<Template>

See

getSource. Override load to implement a caching loader.

Inherited from

Loader.load

Defined in

src/loader.ts:76


loadSync()

loadSync(name, environment, context?, globals?, loaderContext?): Template

A synchronous version of load.

Parameters

name: string

environment: Environment

context?: RenderContext

globals?: ContextScope

loaderContext?

Returns

Template

See

load

Inherited from

Loader.loadSync

Defined in

src/loader.ts:97