A defined lifecycle is essential for consistent and efficient processing of state changes during the lifetime
of a <fx-fore>
element.
The diagram below might read a bit complex at first sight but pretty much touches all important areas of Fore and might be a useful read for the interested developer.
<fx-fore>
element gets connected, it will wait for all children to be connected and then call modelConstruct()
on the <fx-model>
element to kick off the initialization process. If no <fx-model>
is present one will be created. A model-construct
event will be emitted.<fx-instance>
elements within its child elements and call init()
for each of them. This
might involve loading data from an URL.instance-loaded
event will be dispatched for each instance once it’s loaded.rebuild()
the model will build its dependency graph by inspecting all <fx-bind>
elements within the model.ref
attribute is pointing to a ModelItem
object is created that holds the state of the
data node. By inspecting the calculate
, constraint
, readonly
, relevant
and required
attributes of a Bind the dependencies between
data nodes are detected and added to the Main Dependency Graph (MDG).recalculate()
evaluates all calculate
attributes in the order given by the MDG.revalidate()
evaluates all constraint
, readonly
, relevant
and required
attributes to determine the validity of a ModelItem.model-construct-done
event is emitted and catched by <fx-fore>
element.initUI
which will find all bound elements within the scope of the <fx-fore>
element.refresh()
for each of them.refresh-done
event once all UI elements have been refreshed