Comp
@Js
mixin Comp
Component or function block - see documentation.
Add a slot
Add a slot if value is not null
Call component function slot by name
Lookup a child component by name
CompSpace used to create this component
Return display string for this component
Iterate slot name/value pairs using same semantics as get
Iterate children components in the tree structure
Iterate name/value pairs until callback returns non-null
Schedule an callback to onExecute on the next execution cycle
Get the given slot value or null if slot name not defined
Return true if this component has slot with non-null value
Check if a child component is mapped by the given name
Return if this component has a method function slot by given name
Return id that uniquely identifies this component within its space
Return if this component is mounted into a component space
Gets links slot as dict of incoming component links
Return true if this component does not have slot with non-null value
Slot name under parent or "" if parent is null
Callback when a method is called on this instance
Callback when a slot is modified on this instance
Callback to recompute component state
How often should this component have its onExecute callback invoked
Parent component or null if root/unmounted
Remove a slot by name
Reorder the slots
Set a slot by name
Xeto type for this component
Get or set the slot mapped by the given name
@Operator
This add(Obj val, Str? name := null)
Add a slot. If name is null one is auto-generated otherwise the name must be unique.
This addNotNull(Obj? val, Str? name := null)
Add a slot if value is not null. If name is null one is auto-generated.
Obj? call(Str name, Obj? arg)
Call component function slot by name.
virtual Comp? child(Str name, Bool checked := true)
Lookup a child component by name
CompSpace cs()
CompSpace used to create this component
Str dis()
Return display string for this component
Void each(|Obj,Str| f)
Iterate slot name/value pairs using same semantics as get.
Void eachChild(|Comp,Str| f)
Iterate children components in the tree structure
Obj? eachWhile(|Obj,Str->Obj?| f)
Iterate name/value pairs until callback returns non-null
Void execute()
Schedule an callback to onExecute on the next execution cycle. See Comps.
@Operator
Obj? get(Str name)
Get the given slot value or null if slot name not defined.
Bool has(Str name)
Return true if this component has slot with non-null value.
Bool hasChild(Str name)
Check if a child component is mapped by the given name
Bool hasFunc(Str name)
Return if this component has a method function slot by given name
Ref id()
Return id that uniquely identifies this component within its space.
Bool isMounted()
Return if this component is mounted into a component space
Links links()
Gets links slot as dict of incoming component links
Bool missing(Str name)
Return true if this component does not have slot with non-null value.
Str name()
Slot name under parent or "" if parent is null
virtual Void onCall(CompCallEvent event)
Callback when a method is called on this instance.
virtual Void onChange(CompChangeEvent event)
Callback when a slot is modified on this instance. The slot is non-null if name maps to a slot on the component's spec. If the operation if a remove then newVal is null.
virtual Void onExecute()
Callback to recompute component state. This is always called
within a CompContext. If not overriden then the default behavior
attempts to call the onExecute method defined in Xeto.
See Comps.
virtual Duration? onExecuteFreq()
How often should this component have its onExecute callback invoked. Return null if this component has no time based computation.
virtual Comp? parent()
Parent component or null if root/unmounted
This remove(Str name)
Remove a slot by name. Do nothing is name isn't mapped.
This reorder(Str[] names)
Reorder the slots. The given list of names must match the existing slot names. Slots defined statically by the spec cannot be reordered and will have indetermine behavior if they are not included in the their original order (in the future this may raise an exception).
@Operator
This set(Str name, Obj? val)
Set a slot by name. If val is null, then this is a convenience for remove.
Spec spec()
Xeto type for this component
Obj? trap(Str name, Obj?[]? args := null)
Get or set the slot mapped by the given name.