Class Behavior<TData, TProperty, TMethod, TChainingFilter, TExtraThisFields>

Common mixin-like behavior

Each component definition contains a single root behavior. A behavior can mixin other behaviors.

Type Parameters

  • TData extends DataList
  • TProperty extends PropertyList
  • TMethod extends MethodList
  • TChainingFilter extends ChainingFilterType
  • TExtraThisFields extends DataList = Empty

Constructors

Properties

is: string
ownerSpace: ComponentSpace

Methods

  • Parameters

    • template: {
          [key: string]: unknown;
      }
      • [key: string]: unknown

    Returns void

  • Get the methods

    Only valid after prepare .

    Returns TMethod

  • Get the type of the specified property

    Only valid after prepare . Return undefined if the name is not a property.

    Parameters

    • name: string

    Returns undefined | null | NormalizedPropertyType[]

  • Get the type of the specified property

    Only valid after prepare . Return undefined if the name is not a property.

    Parameters

    • name: string

    Returns undefined | NormalizedPropertyType

  • Get the template content

    This method is usually used by the template engine.

    Returns undefined | {
        [key: string]: unknown;
    }

  • Check whether the other behavior is a dependent behavior of this behavior

    Parameters

    Returns boolean

  • List the properties

    Only valid after prepare .

    Returns string[]

  • Execute the prepare phase (an optimization phase) of this behavior

    Every behavior needs this phase for better future performance. However, this phase requires a little time for execution, and requires its all dependent behaviors created. If a dependent behavior is not prepared, then its prepare phase is also executed.

    Returns void