Class: AvenxComponent

AvenxComponent(initialStateopt, computedopt, bridgesopt, templateopt, methodsopt)

Base class for all Avenx components. Manages state, reactivity, rendering, and lifecycle.

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.

Source:

Classes

AvenxComponent

Members

props :Proxy

The reactive props of the component.

Type:
  • Proxy
Source:

state :Proxy

The reactive state of the component.

Type:
  • Proxy
Source:

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.

Source:
Returns:

The result of the evaluation.

Type
any

(protected) _getBridges() → {Object}

Source:
Returns:

The bridges accessible to the component.

Type
Object

(protected) _getElement() → {Element|null}

Source:
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.

Source:

render() → {string}

Renders the component template with current state.

Source:
Returns:

The rendered HTML string.

Type
string

scheduleUpdate()

Schedules an update to run asynchronously in a microtask. Deduplicates multiple calls to schedule.

Source:

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.

Source:

unmount()

Unmounts the component and triggers cleanup.

Source: