delite/CustomElement
delite/CustomElement
is a base class for non-visual custom elements, such as an element representing a data store.
It also serves as the base class for Widget.
Behind the scenes, delite/CustomElement
provides many of the features mentioned in the
Introduction to delite and custom elements. In particular,
it parses attributes in declarative markup, for example converting:
<my-widget numProp="123"></my-widget>
into:
myWidget.numProp = 123;
It also provides common methods like on()
and destroy()
.
Note though that delite/CustomElement
does not provide the delite specific lifecycle methods
like buildRendering()
, postCreate()
, and startup()
. These are from Widget
.
Delite/CustomElement
instead uses the function names from the Custom Elements specification:
createdCallback()
and enteredViewCallback()
.
Finally, note that for performance reasons, delite does not set up document level listeners for DOM nodes
being attached / removed from the document. Therefore, when creating CustomElement
based elements programatically
and attaching them to the document, you need to call enteredViewCallback()
manually.