Skip to main content

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

XMLHttpRequestLoader

Overrides

Loader.constructor

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

Loader.getSource

Defined in

src/builtin/loaders/xml_http_request_loader.ts:42


getSourceSync()

getSourceSync(name): TemplateSource

A synchronous version of getSource.

Parameters

name: string

Returns

TemplateSource

See

getSource

Overrides

Loader.getSourceSync

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

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


url()

protected url(name): string

Parameters

name: string

Returns

string

Defined in

src/builtin/loaders/xml_http_request_loader.ts:66