Hello World!

Notice that the template is created with the domplate function and contains one tag definition. The tag consists of one DIV constructor (a function).
In order to execute the template, the example uses a replace method (there are other methods yet) and passes an input object (empty in this case), parent DOM node (where the result should be inserted) and scope object (the template itself) into it.

How to use input data

This example shows how an input object can be used to provide dynamic data for a template.

The template refers to a property of the input object using a "$" character at the beginning of the property name. Standard dot notation is used to access inner properties. The actual value from the object is used when the template is executed.

How to construct a FOR Loop

This example shows how to use a FOR loop and iterate array of input objects.

A loop is constructed using a FOR constructor, which expects two parameters. The first one defines a variable, which contains the actual value from the array in each cycle and the second one is the array to be iterated.

The template registers a handler for every generated <div> element, that shows an alert box with the content of the clicked element. Notice that the scope object (which is usually the template itself) is used to execute the handleClick function.

If the constructor's attribute name begins with "on", it's treated as an event name (without "on") for the correspondend DOM event. It's value must always be a function, that is registered as the event listener.