Members
(readonly) ancestors :Array.<Composite>
The ancestor composites ordered by closest to furthest
- Source:
Type:
-
Array.<Composite>
(readonly) hasChild :boolean
Whether this has one or more child composites
- Source:
Type:
-
boolean
(readonly) hasParent :boolean
Whether this has parent composite
- Source:
Type:
-
boolean
Methods
addChild(Cp) → {Composite}
Adds a child composite
- Source:
Parameters:
Name | Type | Description |
---|---|---|
Cp |
Composite
|
The composite to add as a child |
addChildren(Cps) → {Composite}
Adds multiple child composites
- Source:
Parameters:
Name | Type | Description |
---|---|---|
Cps |
Array.<Composite>
|
The array of the composites to add |
traverse(Fn, Depth, Arg) → {boolean}
Performs tree traversal
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Fn |
function
|
The callback that receives every descendant composite as the 1st parameter.
If |
|
Depth |
number
|
-1 |
The limit of traversal depth. Negative number means no-limit |
Arg |
mixed
|
null |
Additinal argument to pass to |
Returns:
- Type:
-
boolean
true
if the traversal is successfully completed.
false
if the traversal is aborted
verifyChild(Cp) → {boolean|string}
Determines whether the specified composite can be added as a child
- Source:
Parameters:
Name | Type | Description |
---|---|---|
Cp |
Composite
|
The composite which is about to be added |
Returns:
- Type:
-
boolean
|string
true
if Cp
is valid. Any type other than true
means invalid.
If a string is returned, it is shown as an error message in the debug console