Skip to main content

Class: MapLoader

A loader that uses a Map of strings to store template source Text.

Extends

Constructors

new MapLoader()

new MapLoader(map?): MapLoader

Parameters

map?: Map<string, string>

Returns

MapLoader

Overrides

Loader.constructor

Defined in

src/builtin/loaders/map_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/map_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/map_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