Constructor
new AvenxComponent(initialStateopt, computedopt, bridgesopt, templateopt, methodsopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
initialState |
Object |
<optional> |
{} | The initial state of the component. |
computed |
Object |
<optional> |
{} | Computed properties definitions. |
bridges |
Object |
<optional> |
{} | External bridges accessible to the component. |
template |
string |
<optional> |
'' | The HTML template string. |
methods |
Object |
<optional> |
{} | Component methods. |
Classes
Members
props :Proxy
The reactive props of the component.
Type:
- Proxy
state :Proxy
The reactive state of the component.
Type:
- Proxy
Methods
(protected) _evaluate(expression, extraScopeopt) → {any}
Evaluates an expression in the component's scope.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
expression |
string | The expression to evaluate. |
||
extraScope |
Object |
<optional> |
{} | Additional scope variables. |
Returns:
The result of the evaluation.
- Type
- any
(protected) _getBridges() → {Object}
Returns:
The bridges accessible to the component.
- Type
- Object
(protected) _getElement() → {Element|null}
Returns:
The component's root element.
- Type
- Element | null
mount(target)
Mounts the component to a target element.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Element | string | The target element or selector. |
render() → {string}
Renders the component template with current state.
Returns:
The rendered HTML string.
- Type
- string
scheduleUpdate()
Schedules an update to run asynchronously in a microtask. Deduplicates multiple calls to schedule.
setProps(newProps)
Updates the component's props and triggers an update if they changed.
Parameters:
| Name | Type | Description |
|---|---|---|
newProps |
Object | The new props to apply. |
unmount()
Unmounts the component and triggers cleanup.