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
Overrides
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
Defined in
src/builtin/loaders/map_loader.ts:15
getSourceSync()
getSourceSync(
name
):TemplateSource
A synchronous version of getSource
.
Parameters
• name: string
Returns
See
Overrides
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
Defined in
loadSync()
loadSync(
name
,environment
,context
?,globals
?,loaderContext
?):Template
A synchronous version of load
.
Parameters
• name: string
• environment: Environment
• context?: RenderContext
• globals?: ContextScope
• loaderContext?