This holds the components root element, for a HTMLComponent
, this would be the Button or paragraph tag, or for a Component
, this is the containing div.
The _render
method should mount any child elements to this element, so it should be safe to set this before its rendered.
This method is used to initalise the component. It calls the _render
method and mounts this.element
to the parent
element passed to it.
_render mounts children to the element
This hook allows you to get a reference to the parent element when it is mounted for the first time to the dom. This hook is only called when its registered as a web component.
This method is where which you should override to compose together child components to build your own components.
Returns an array of SuperComponents
or arrays of SuperComponents
that should be rendered.
This method should be called when the content inside the component has been updated. The most juniour component that needs to be updated should be called to help performance.
For example, if you have the choice of rerendering a parent or its child, if the visual update only concerns the child, then calling rerender on the child is prefered.
Generated using TypeDoc
WebComponent is a specialization of Component which aids in the creation of Web Components