Comp
@Js
mixin Comp
Component or function block
Parent component or null if root/unmounted
Add a slot if value is not null
How often should this component have its onExecute callback invoked
Reorder the slots
Remove a slot by name
Xeto type for this component
Return display string for this component
Get the given slot value or null if slot name not defined
Return true if this component does not have slot with non-null value
Gets links slot as dict of incoming component links
Return true if this component has slot with non-null value
Return id that uniquely identifies this component within its space
Get or set the slot mapped by the given name
Add a slot
Return debug string
Set a slot by name
Callback when a slot is modified on this instance
Iterate children components in the tree structure
Return if this component is mounted into a component space
Callback to recompute component state
Schedule an callback to onExecute on the next execution cycle
Return if this component has a method by given name
Iterate slot name/value pairs using same semantics as get
Call component method slot
Check if a child component is mapped by the given name
Slot name under parent or "" if parent is null
Iterate name/value pairs until callback returns non-null
Lookup a child component by name
@Operator
This add(Obj val, Str? name)
Add a slot. If name is null one is auto-generated otherwise the name must be unique.
This addNotNull(Obj? val, Str? name)
Add a slot if value is not null. If name is null one is auto-generated.
Obj? call(Str name, Obj? arg)
Call component method slot
virtual Comp? child(Str name, Bool checked)
Lookup a child component by name
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
@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 hasMethod(Str name)
Return if this component has a method 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 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.
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
virtual Str toStr()
Return debug string
Obj? trap(Str name, Obj?[]? args)
Get or set the slot mapped by the given name.