Documentation
    Preparing search index...

    Interface TwingArrayLoader

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

    Hierarchy (View Summary)

    Index

    Properties

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

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

    Type Declaration

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

        • name: string

          The name of the template to check if we can load

        • from: string | null

          The source that initiated the template loading

        Returns Promise<boolean>

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

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

    Returns the source for a given template logical name.

    Type Declaration

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

        • name: string

          The template logical name

        • from: string | null

          The source that initiated the template loading

        Returns Promise<TwingSource | null>

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

    Returns true if the template is still fresh.

    Type Declaration

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

        • name: string

          The template name

        • time: number

          Timestamp of the last modification time of the cached template

        • from: string | null

          The source that initiated the template loading

        Returns Promise<boolean | null>

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

    TwingErrorLoader When name is not found

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

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

    Type Declaration

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

        • name: string

          The name of the template to load

        • from: string | null

          The source that initiated the template loading

        Returns Promise<string | null>

        The cache key

    Methods