LS.LS Class
LS is the global scope for the global functions and containers of LiteScene
Item Index
Methods
Properties
Methods
clearUIds
-
root
Clears all the uids inside this object and children (it also works with serialized object)
Parameters:
-
root
Objectcould be a node or an object from a node serialization
cloneObject
-
object
-
target=null
Clones an object (no matter where the object came from)
- It skip attributes starting with "_" or "jQuery" or functions
- it tryes to see which is the best copy to perform
- to the rest it applies JSON.parse( JSON.stringify ( obj ) )
- use it carefully
Parameters:
-
object
Objectthe object to clone
-
target=null
Objectoptional, the destination object
Returns:
returns the cloned object (target if it is specified)
extendClass
-
target
-
origin
copy the properties (methods and properties) of origin class into target class
Parameters:
-
target
Class -
origin
Class
generateUId
()
String
Generates a UUID based in the user-agent, time, random and sequencial number. Used for Nodes and Components.
Returns:
uuid
getClassName
-
class
Returns an string with the class name
Parameters:
-
class
Objectobject
Returns:
returns the string with the name
getObjectClassName
-
the
Returns an object class name (uses the constructor toString)
Parameters:
-
the
Objectobject to see the class name
Returns:
returns the string with the name
getObjectProperties
-
object
Returns the public properties of one object and the type (not the values)
Parameters:
-
object
Object
Returns:
returns object with attribute name and its type
getScript
-
name
Returns an script context using the script name (not the node name), usefull to pass data between scripts.
Parameters:
-
name
Stringthe name of the script according to the Script component.
Returns:
the context of the script.
isClassComponent
-
comp
Tells you if one class is a registered component class
Parameters:
-
comp
ComponentClasscomponent class to evaluate
Returns:
true if the component class is registered
registerComponent
-
c
Register a component (or several) so it is listed when searching for new components to attach
Parameters:
-
c
ComponentClasscomponent class to register
registerMaterialClass
-
comp
Register a Material class so it is listed when searching for new materials to attach
Parameters:
-
comp
ComponentClasscomponent class to register
registerResourceClass
-
c
Register a resource class so we know which classes could be use as resources
Parameters:
-
c
ComponentClasscomponent class to register
replaceComponentClass
-
scene
-
old_class_name
-
new_class_name
Replaces all components of one class in the scene with components of another class
Parameters:
-
scene
SceneTreewhere to apply the replace
-
old_class_name
Stringname of the class to be replaced
-
new_class_name
Stringname of the class that will be used instead
reset
()
clears the global scene and the resources manager
safeCall
-
callback
-
params
-
instance
Is a wrapper for callbacks that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callback
Function -
params
Array -
instance
Object
setInterval
-
callback
-
time
-
timer_id
Is a wrapper for setInterval that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callback
Function -
time
Numberin ms
-
timer_id
Number
setTimeout
-
callback
-
time
-
timer_id
Is a wrapper for setTimeout that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callback
Function -
time
Numberin ms
-
timer_id
Number
validateName
-
name
validates name string to ensure there is no forbidden characters valid characters are letters, numbers, spaces, dash, underscore and dot
Parameters:
-
name
String
Returns:
Properties
Components
Object
Contains all the registered components
Default: {}
MaterialClasses
Object
Contains all the registered material classes
Default: {}