Documentation
    Preparing search index...

    Interface TwingFilesystemLoader

    interface TwingFilesystemLoader {
        exists: (name: string, from: null | string) => Promise<boolean>;
        getSource: (
            name: string,
            from: null | string,
        ) => Promise<null | TwingSource>;
        isFresh: (
            name: string,
            time: number,
            from: null | string,
        ) => Promise<null | boolean>;
        resolve: (name: string, from: null | string) => Promise<null | string>;
        addPath(path: string, namespace?: null | string): void;
        prependPath(path: string, namespace?: null | string): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

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

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

    Type declaration

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

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

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

    Returns the source for a given template logical name.

    Type declaration

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

        • name: string

          The template logical name

        • from: null | string

          The source that initiated the template loading

        Returns Promise<null | TwingSource>

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

    Returns true if the template is still fresh.

    Type declaration

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

        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) => Promise<null | string>

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

    Type declaration

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

        The cache key

    Methods

    • Adds a path where templates are stored.

      Parameters

      • path: string

        A path where to look for templates

      • Optionalnamespace: null | string

        A path namespace

      Returns void

    • Prepends a path where templates are stored.

      Parameters

      • path: string

        A path where to look for templates

      • Optionalnamespace: null | string

        A path namespace

      Returns void