Class Template<T>

A template that can be used to render HTML content.

Type Parameters

Hierarchy (view full)

Constructors

  • Creates a new template.

    Type Parameters

    Parameters

    • content: TemplateContent | ((params) => TemplateContent | Promise<TemplateContent>)

      The content of the template, or a function that returns the content.

    Returns Template<T>

Properties

content: TemplateContent | ((params) => TemplateContent | Promise<TemplateContent>)

The content of the template, or a function that returns the content.

Type declaration

    • (params): TemplateContent | Promise<TemplateContent>
    • Parameters

      • params: T

      Returns TemplateContent | Promise<TemplateContent>

Methods

  • Renders the template with the given params (if content is a function).

    Parameters

    • params: T

      The params to pass to the template.

    Returns Promise<RawContent>

    The rendered template as a RawContent instance.

  • Renders the template with the given params (if content is a function).

    Parameters

    • params: T

      The params to pass to the template.

    Returns Promise<string>

    The rendered template.

  • Returns the HTML string representation of a child of the template.

    Parameters

    • Optional child: TagChild<any>

      The child to stringify.

    Returns string

    The HTML string representation of the child.

Generated using TypeDoc