Interface AttrOptions<Type, TypeHint>
attribute?: string;
converter?: ComplexAttributeConverter<Type, TypeHint>;
reflect?: boolean;
type: TypeHint;
}
Type Parameters
- Type = unknown
- TypeHint = unknown
Index
Properties
Properties
Optionalattribute
Optionalconverter
Indicates how to convert the attribute to/from a property. If this value
is a function, it is used to convert the attribute value a the property
value. If it's an object, it can have keys for fromAttribute and
toAttribute. If no toAttribute function is provided and
reflect is set to true, the property value is set directly to the
attribute. A default converter is used if none is provided; it supports
Boolean, String, Number, Object, and Array. Note,
when a property changes and the converter is used to update the attribute,
the property is never updated again as a result of the attribute changing,
and vice versa.
Optionalreflect
Indicates if the property should reflect to an attribute.
If true, when the property is set, the attribute is set using the
attribute name determined according to the rules for the attribute
property option and the value of the property converted using the rules
from the converter property option.
type
Indicates the type of the property. This is used only as a hint for the
converter to determine how to convert the attribute
to/from a property.
Indicates the name of the observed attribute. If absent, the lowercased property name is observed (e.g.
fooBarbecomesfoobar). If a string, the string value is observed (e.gattribute: 'foo-bar').