Class: XMLHttpRequestLoader
A template loader that uses XMLHttpRequest to fetch templates.
Extends
Constructors
new XMLHttpRequestLoader()
new XMLHttpRequestLoader(
baseURL
,options
):XMLHttpRequestLoader
The XMLHttpRequestLoader
constructor.
Parameters
• baseURL: string
The base URL from which to fetch templates from.
• options: XMLHttpRequestLoaderOptions
= {}
Loader options.
Returns
Overrides
Defined in
src/builtin/loaders/xml_http_request_loader.ts:36
Properties
baseURL
readonly
baseURL:string
Defined in
src/builtin/loaders/xml_http_request_loader.ts:27
bustBrowserCache
readonly
bustBrowserCache:boolean
Defined in
src/builtin/loaders/xml_http_request_loader.ts:28
Methods
fetch()
protected
fetch(url
):Promise
<XMLHttpRequest
>
Parameters
• url: string
Returns
Promise
<XMLHttpRequest
>
Defined in
src/builtin/loaders/xml_http_request_loader.ts:79
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/xml_http_request_loader.ts:42
getSourceSync()
getSourceSync(
name
):TemplateSource
A synchronous version of getSource
.
Parameters
• name: string
Returns
See
Overrides
Defined in
src/builtin/loaders/xml_http_request_loader.ts:53
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?
Returns
See
Inherited from
Defined in
url()
protected
url(name
):string
Parameters
• name: string
Returns
string