type

Comp

@Js
mixin Comp

Component or function block

methods

add

Add a slot.

call

Call a method slot synchronously.

callAsync

Call a method slot asynchronously.

child

Lookup a child component by name

dis

Return display string for this component

each

Iterate slot name/value pairs using same semantics as get.

eachChild

Iterate children components in the tree structure

eachWhile

Iterate name/value pairs until callback returns non-null

get

Get the given slot value or null if slot name not defined.

has

Return true if this component has a slot by given name.

hasChild

Check if a child component is mapped by the given name

id

Return id that uniquely identifies this component within its space.

isAbove

Is this is an ancestor in the tree of the given component.

isBelow

Is this component is a descendant in the tree of the given component.

isMounted

Return if this component is mounted into a component space

links

Gets links slot as dict of incoming component links

missing

Return true if the component does not have a slot by given name.

name

Slot name under parent or "" if parent is null

onCall

Callback when a method is called.

onCallRemove

Remove an onCall callback

onCallThis

Callback on instance itself when a call is invoked.

onChange

Callback when a slot is modified.

onChangeRemove

Remove an onChange callback

onChangeThis

Callback on instance itself when a slot is modified.

onExecute

Callback to recompute component state.

onExecuteFreq

How often should this component have its onExecute callback invoked.

parent

Parent component or null if root/unmounted

remove

Remove a slot by name.

set

Set a slot by name.

spec

Xeto type for this component

toStr

Return debug string

trap

Get or set the slot mapped by the given name.

Slot Details

add

@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.

call

Obj? call(Str name, Obj? arg := null)

Call a method slot synchronously. If slot is not found then silently ignore and return null. If slot is defined but not a Function or the Function must be called asynchronously then raise exception.

callAsync

Void callAsync(Str name, Obj? arg, |Err?,Obj?| cb)

Call a method slot asynchronously. If slot is not found then silently ignore and return null. If slot is defined but not an Function then raise exception.

child

virtual Comp? child(Str name, Bool checked := true)

Lookup a child component by name

dis

Str dis()

Return display string for this component

each

Void each(|Obj,Str| f)

Iterate slot name/value pairs using same semantics as get.

eachChild

Void eachChild(|Comp,Str| f)

Iterate children components in the tree structure

eachWhile

Obj? eachWhile(|Obj,Str->Obj?| f)

Iterate name/value pairs until callback returns non-null

get

@Operator
Obj? get(Str name)

Get the given slot value or null if slot name not defined.

has

Bool has(Str name)

Return true if this component has a slot by given name.

hasChild

Bool hasChild(Str name)

Check if a child component is mapped by the given name

id

Ref id()

Return id that uniquely identifies this component within its space.

isAbove

Bool isAbove(Comp child)

Is this is an ancestor in the tree of the given component. If the given component is this, then return true.

isBelow

Bool isBelow(Comp parent)

Is this component is a descendant in the tree of the given component. If the given component is this, then return true.

isMounted

Bool isMounted()

Return if this component is mounted into a component space

Links links()

Gets links slot as dict of incoming component links

missing

Bool missing(Str name)

Return true if the component does not have a slot by given name.

name

Str name()

Slot name under parent or "" if parent is null

onCall

Void onCall(Str name, |This,Obj?| cb)

Callback when a method is called. This is an observer callback only and will not determine the result value of calling a method.

onCallRemove

Void onCallRemove(Str name, Func cb)

Remove an onCall callback

onCallThis

virtual Void onCallThis(Str name, Obj? arg)

Callback on instance itself when a call is invoked.

onChange

Void onChange(Str name, |This,Obj?| cb)

Callback when a slot is modified. The newVal is null if the slot was removed.

onChangeRemove

Void onChangeRemove(Str name, Func cb)

Remove an onChange callback

onChangeThis

virtual Void onChangeThis(Str name, Obj? newVal)

Callback on instance itself when a slot is modified. Value is null if slot removed.

onExecute

virtual Void onExecute(CompContext cx)

Callback to recompute component state.

onExecuteFreq

virtual Duration? onExecuteFreq()

How often should this component have its onExecute callback invoked. Return null if this component has no time based computation.

parent

virtual Comp? parent()

Parent component or null if root/unmounted

remove

This remove(Str name)

Remove a slot by name. Do nothing is name isn't mapped.

set

@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 spec()

Xeto type for this component

toStr

virtual override Str toStr()

Return debug string

trap

override Obj? trap(Str name, Obj?[]? args := null)

Get or set the slot mapped by the given name.