LS.ComponentContainer Class
ComponentContainer class allows to add component based properties to any other class
Constructor
LS.ComponentContainer
()
Item Index
Methods
addComponent
-
component
Adds a component to this node. (maybe attach would been a better name)
Parameters:
-
component
Object
Returns:
component added
configureComponents
-
info
Adds a component to this node.
Parameters:
-
info
Objectobject containing all the info from a previous serialization
getComponent
-
component_class
-
index
Returns the first component of this container that is of the same class
Parameters:
-
component_class
Object | Stringthe class to search a component from (could be the class or the name)
-
index
Number[optional] if you want the Nth component of this class
getComponentByIndex
-
component
Returns the component at index position
Parameters:
-
component
Object
getComponentByUId
-
uid
Returns the component with the given uid
Parameters:
-
uid
Stringthe uid to search
getComponents
()
Array
returns an array with all the components
Returns:
all the components
getIndexOfComponent
-
position
Returns the position in the components array of this component
Parameters:
-
position
Numberin the array, -1 if not found
hasComponent
-
component_class
-
search_missing
Returns if the container has a component of this class
Parameters:
-
component_class
String | Classthe component to search for, could be a string or the class itself
-
search_missing
Boolean[optional] true if you want to search in the missing components too
processActionInComponents
-
action_name
-
params
executes the method with a given name in all the components
Parameters:
-
action_name
Stringthe name of the function to execute in all components (in string format)
-
params
Arrayarray with every parameter that the function may need
removeAllComponents
-
component
Removes all components from this node.
Parameters:
-
component
Object
removeComponent
-
component
Removes a component from this node.
Parameters:
-
component
Object
serializeComponents
-
o
Adds a component to this node.
Parameters:
-
o
Objectcontainer where the components will be stored
setComponentIndex
-
component
Changes the order of a component
Parameters:
-
component
Object