Skip to content

Attribute Parser

Esther Brunner edited this page Oct 9, 2024 · 9 revisions

Attribute Parser

Web Components can have observed attributes, that trigger the attributeChangedCallback:

static observedAttributes = ['value']

UIElement parses these attributes according to a declarative static property called attributeMap:

static attributeMap = {
    value: asInteger
}

The UIElement base class will assign them to signals in the component with the same name as key:

this.get('value') // will return the current value of the `value` signal as an integer `number` or `undefined` if not a number
Clone this wiki locally