Class: ChoiceLoader
A template loader that will try each of an array of loaders until
a template is found, or throw a TemplateNotFoundError
if none of
the loaders could find the template.
Extends
Constructors
new ChoiceLoader()
new ChoiceLoader(
loaders
):ChoiceLoader
Parameters
• loaders: Loader
[]
Returns
Overrides
Defined in
src/builtin/loaders/choice_loader.ts:18
Properties
loaders
readonly
loaders:Loader
[]
Defined in
src/builtin/loaders/choice_loader.ts:18
Methods
getSource()
getSource():
Promise
<TemplateSource
>
Override getSource
to implement a custom loader.
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/choice_loader.ts:22
getSourceSync()
getSourceSync():
TemplateSource
A synchronous version of getSource
.
Returns
See
Overrides
Defined in
src/builtin/loaders/choice_loader.ts:27
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.
Overrides
Defined in
src/builtin/loaders/choice_loader.ts:33
loadSync()
loadSync(
name
,environment
,context
?,globals
?,loaderContext
?):Template
A synchronous version of load
.
Parameters
• name: string
• environment: Environment
• context?: RenderContext
• globals?: ContextScope
• loaderContext?