Interface TwingArrayLoader

interface TwingArrayLoader {
    exists: ((name, from) => Promise<boolean>);
    getSource: ((name, from) => Promise<null | TwingSource>);
    isFresh: ((name, time, from) => Promise<null | boolean>);
    resolve: ((name, from) => Promise<null | string>);
    setTemplate(name, template): void;
}

Hierarchy (view full)

Properties

exists: ((name, from) => Promise<boolean>)

Check if we have the source code of a template, given its name.

Type declaration

    • (name, from): Promise<boolean>
    • Parameters

      • name: string

        The name of the template to check if we can load

      • from: null | string

        The source that initiated the template loading

      Returns Promise<boolean>

Returns

If the template source code is handled by this loader or not

getSource: ((name, from) => Promise<null | TwingSource>)

Returns the source for a given template logical name.

Type declaration

    • (name, from): Promise<null | TwingSource>
    • Parameters

      • name: string

        The template logical name

      • from: null | string

        The source that initiated the template loading

      Returns Promise<null | TwingSource>

Returns

isFresh: ((name, time, from) => Promise<null | boolean>)

Returns true if the template is still fresh.

Type declaration

    • (name, time, from): Promise<null | boolean>
    • Parameters

      • name: string

        The template name

      • time: number

        Timestamp of the last modification time of the cached template

      • from: null | string

        The source that initiated the template loading

      Returns Promise<null | boolean>

Returns

true if the template is fresh, false otherwise; null if it does not exist

Throws

TwingErrorLoader When name is not found

resolve: ((name, from) => Promise<null | string>)

Resolve a template FQN from its name and the name of the template that initiated the loading.

Type declaration

    • (name, from): Promise<null | string>
    • Parameters

      • name: string

        The name of the template to load

      • from: null | string

        The source that initiated the template loading

      Returns Promise<null | string>

Returns

The cache key

Methods

  • Parameters

    • name: string
    • template: string

    Returns void

Generated using TypeDoc