LS.ComponentContainer Class
ComponentContainer class allows to add component based properties to any other class
Constructor
LS.ComponentContainer
()
Item Index
Methods
Methods
addComponent
-
component
Adds a component to this node. (maybe attach would been a better name)
Parameters:
-
componentObject
Returns:
component added
broadcastMessage
-
method_name -
params
executes the method with a given name in all the components and its children
Parameters:
-
method_nameStringthe name of the function to execute in all components (in string format)
-
paramsArrayarray with every parameter that the function may need
configureComponents
-
info
Adds a component to this node.
Parameters:
-
infoObjectobject containing all the info from a previous serialization
findComponent
-
component
Returns a list of components matching the search, it search in the node and child nodes
Parameters:
-
componentClass | Stringthe component class or the class name
Returns:
an array with all the components of the same class
getComponent
-
component_class -
index
Returns the first component of this container that is of the same class
Parameters:
-
component_classObject | Stringthe class to search a component from (could be the class or the name)
-
indexNumber[optional] if you want the Nth component of this class
getComponentByIndex
-
component
Returns the component at index position
Parameters:
-
componentObject
getComponentByUId
-
uid
Returns the component with the given uid
Parameters:
-
uidStringthe 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:
-
positionNumberin the array, -1 if not found
hasComponent
-
component_class -
search_missing
Returns if the container has a component of this class
Parameters:
-
component_classString | Classthe component to search for, could be a string or the class itself
-
search_missingBoolean[optional] true if you want to search in the missing components too
processActionInComponents
-
method_name -
params -
skip_scripts
executes the method with a given name in all the components
Parameters:
-
method_nameStringthe name of the function to execute in all components (in string format)
-
paramsArrayarray with every parameter that the function may need
-
skip_scriptsBoolean[optional] skip scripts
removeAllComponents
-
component
Removes all components from this node.
Parameters:
-
componentObject
removeComponent
-
component
Removes a component from this node.
Parameters:
-
componentObject
requireComponent
-
component_class -
data
Ensures this node has a component of the specified class, if not it creates one and attaches it
Parameters:
-
component_classObject | Stringthe class to search a component from (could be the class or the name)
-
dataObject[optional] the object to configure the component from
Returns:
the component found or created
requireScript
-
url
Ensures this node has a ScriptFromFile component of the specified script url, if not it creates one and attaches it
Parameters:
-
urlStringthe url to the script
Returns:
the ScriptFromFile component found or created
serializeComponents
-
o
Adds a component to this node.
Parameters:
-
oObjectcontainer where the components will be stored
setComponentIndex
-
component
Changes the order of a component
Parameters:
-
componentObject
