Class: AvenxPage

AvenxPage(initialState, computed, bridges, template, methods, componentRegistry, props, styles, resourcesopt, optionsopt)

AvenxPage is a specialized component that can host child components. It automatically mounts child components defined in its template via [data-avenx-comp].

Constructor

new AvenxPage(initialState, computed, bridges, template, methods, componentRegistry, props, styles, resourcesopt, optionsopt)

Parameters:
Name Type Attributes Description
initialState object

Initial state.

computed object

Computed properties.

bridges object

Shared bridges.

template string

HTML template.

methods object

Component methods.

componentRegistry Map:.<string:, function()>

Registry of available components.

props object

Component properties.

styles object

Component CSS variables.

resources object <optional>

Reactive resources.

options object <optional>

Component options and compiler contracts.

Source:

Classes

AvenxPage

Methods

__onChildPropsChanged()

Pushes changed compiled props into already-mounted children.

On the compiled path each data-props-* expression is its own reactive effect, so a prop that changed says so directly instead of the page re-evaluating every prop of every child whenever anything changed.

Coalesced to once per flush: several props of several children can change in one tick, and the mount pass reconciles all of them in one go.

Source:

(protected) _getComponentRegistry() → {Map:.<string:, function()>}

Retrieves the component registry.

Source:
Returns:
Type
Map:.<string:, function()>

runUpdate()

Renders the page, and registers the state its children's props depend on.

Mounting children stays outside the render watcher, in AvenxPage#update: it writes to each child's props, and doing that inside the watcher made the page depend on its children's props, so a child setting its own prop re-ran the parent and overwrote the value.

The reads still have to be inside the watcher, though, or the page has no dependency on the state it passes down. data-props-* expressions are therefore evaluated here for their dependencies and the results discarded. That only mattered once unobserved writes stopped scheduling a render; before, every write re-rendered every component regardless.

Source:

unmount()

Unmounts the page and all child components.

Source:

update()

Updates the page and then mounts/updates child components.

The child pass runs inside AvenxPage#runUpdate, not here, so that the state a data-props-* expression reads is collected by the page's render watcher. Mounting children after super.update() returned put those reads outside the watcher, leaving the page with no dependency on the state it passes down -- which only worked while every write scheduled a re-render regardless of what read it.

Source: