Interface TwingSynchronousLoader

interface TwingSynchronousLoader {
    exists: ((name: string, from: null | string) => boolean);
    getSource: ((name: string, from: null | string) => null | TwingSource);
    isFresh: ((name: string, time: number, from: null | string) => null | boolean);
    resolve: ((name: string, from: null | string) => null | string);
}

Hierarchy (view full)

Properties

exists: ((name: string, from: null | string) => boolean)

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

Type declaration

    • (name, from): 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 boolean

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

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

Returns the source for a given template logical name.

Type declaration

    • (name, from): null | TwingSource
    • Parameters

      • name: string

        The template logical name

      • from: null | string

        The source that initiated the template loading

      Returns null | TwingSource

isFresh: ((name: string, time: number, from: null | string) => null | boolean)

Returns true if the template is still fresh.

Type declaration

    • (name, time, from): 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 null | boolean

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

TwingErrorLoader When name is not found

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

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

Type declaration

    • (name, from): null | string
    • Parameters

      • name: string

        The name of the template to load

      • from: null | string

        The source that initiated the template loading

      Returns null | string

      The cache key