Options
All
  • Public
  • Public/Protected
  • All
Menu

Class If

The If class renders a Renderable based on a condition.

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Constructor

    Parameters

    • condition: boolean

      The condition that determines if the renderable gets rendered.

    • toRenderIf: Renderable | string

      The renderable to render if the condition is true.

    • Optional toRenderElse: Renderable | string

      The renderable to render if the condition is false (and no truthy elif exists).

    Returns If

Properties

Protected templates

templates: SimpleObject

Accessors

r

  • get r(): string
  • Getting for the HTML returned by the render function.

    Returns string

Methods

append

  • Appends templates to the existing templates object.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    • Default value prioritize: boolean = false

      Whether or not to allow appended templates to override existing template properties

    Returns Renderable

elif

  • elif(condition: boolean, toRender: Renderable | string): If
  • Adds a new elif block.

    Parameters

    • condition: boolean

      The condition that determines if the renderable gets rendered.

    • toRender: Renderable | string

      The renderable to render if the condition is true (and the if renderable is false).

    Returns If

else

  • Sets the else renderable.

    Parameters

    • toRender: Renderable | string

      The renderable to render if the condition is false (and no truthy elif exists).

    Returns If

Protected internalRender

render

  • Renders the internalRender function.

    Parameters

    Returns string

toString

  • toString(): string
  • Overrides the toString method called by JavaScript when string concatenate occurs

    Returns string

when

  • Turn on and off the ability for this element to render

    Parameters

    • condition: boolean

      The condition that determines whether or not the element can render.

    Returns Renderable

with

  • Sets the templates.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    Returns Renderable

Generated using TypeDoc