the type of the Custom Element
Override the kind of the attribute.
This API is dedicated for developer of Builders.
Decorates the listener method which is invoked each time the attribute value mutate.
When the attribute name is not specified (i.e. @AttributeBuilder.get()
), then it's discovered from the decorated method name.
The pattern is <prefix><AttributeNameInCamelCase>
, where <prefix>
is by default on
.
the prefix used to discover the attribute name from the method name
Set the default value of the attribute.
If the value is a boolean
, then the kind of the attribute value is set to boolean
too.
the default value
Register a listener which will be invoked when the attribute value mutate.
A listener is callback function (AttributeListener) which have two arguments:
the listener
Provide a fresh builder.
the type of the Custom Element
the attribute name, it's optional only when the decorator API (i.e. AttributeBuilder.decorate) is used
Generated using TypeDoc
The builder handles the initialization of an attribute as well as the registration of its listeners.
The default value of the attribute can be provided using AttributeBuilder.default.
The kind of the attribute can be String or Boolean. The default kind of attribute is String, the switch to Boolean can be done explicitly with AttributeBuilder.boolean or implicitly when a default value (
true
orfalse
) is provided with AttributeBuilder.default.According to the kind of the attribute, the creation of the attribute in the DOM differs. About the kind Boolean, when the value is
true
then the attribute DOM node is added and set with an empty string otherwise, nothing occurs. About the kind String, when the value is notundefined
and notnull
then the attribute DOM node is added and set with the value otherwise, nothing occurs.The listeners of the attribute values are simple callback functions, c.f. AttributeListener. They can be registered with AttributeBuilder.listener.
Finally, the builder can be registered using the method ElementBuilder.builder of the main builder (i.e. ElementBuilder). However, it can also be registered with the decorative style using the decorator AttributeBuilder.decorate.