Skip to content

AbstractComponent

Tim Rücker edited this page Dec 11, 2018 · 7 revisions

All components should inherit from this class because it contains useful properties that can be accessed in the child class.

Class Members

A brief list of all class members with purposes.

public identifier: string

Contains the attribute value of the element, which could be determined by the selector. Since this is a getter, the most recent value of the attribute is always returned, even if it changes during runtime.

public element: Element

Contains the element that could be determined by the selector. For example, the EventListener decorator attaches event listeners to this element.

public selector: string

This is the selector defined by the component decorator. With this variable, components can be defined dynamically so that the selector only has to be changed in one place.

public template: Template

The template property is still a bit experimental. A template selector can be specified via the component decorator, which then searches for a

If the property is not set, but a child element of this.element is an HTMLTemplateElement, then that element will be used as a template.

If the component element has the attribute data-template-source or data-template-source, the URL inside of this attribute will be used to get the template.

public children: any

Contains all HTML elements found by the childSelectors property in the DOM. The structure of this property could look like this:

[
  'child-selector-a': Element[],
  'child-selector-b': Element[],
  ...
]

internal __options: any;

Contains all options passed through the Component Decorator. This property is only used within the framework and can therefore be ignored.

Clone this wiki locally