API Docs for:
Show:

LS.LS Class

Defined in: ../src/core.js:9
Module: LS

LS is the global scope for the global functions and containers of LiteScene

Methods

clearUIds

(
  • root
)

Defined in ../src/core.js:504

Clears all the uids inside this object and children (it also works with serialized object)

Parameters:

  • root Object

    could be a node or an object from a node serialization

cloneObject

(
  • object
  • target=null
)
Object

Defined in ../src/core.js:377

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 Object

    the object to clone

  • target=null Object

    optional, the destination object

Returns:

Object:

returns the cloned object (target if it is specified)

extendClass

(
  • target
  • origin
)

Defined in ../src/core.js:342

copy the properties (methods and properties) of origin class into target class

Parameters:

  • target Class
  • origin Class

generateUId

() String

Defined in ../src/core.js:32

Generates a UUID based in the user-agent, time, random and sequencial number. Used for Nodes and Components.

Returns:

String:

uuid

getClassName

(
  • class
)
String

Defined in ../src/core.js:573

Returns an string with the class name

Parameters:

  • class Object

    object

Returns:

String:

returns the string with the name

getObjectClassName

(
  • the
)
String

Defined in ../src/core.js:548

Returns an object class name (uses the constructor toString)

Parameters:

  • the Object

    object to see the class name

Returns:

String:

returns the string with the name

getObjectProperties

(
  • object
)
Object

Defined in ../src/core.js:598

Returns the public properties of one object and the type (not the values)

Parameters:

  • object Object

Returns:

Object:

returns object with attribute name and its type

getScript

(
  • name
)
Object

Defined in ../src/core.js:704

Returns an script context using the script name (not the node name), usefull to pass data between scripts.

Parameters:

  • name String

    the name of the script according to the Script component.

Returns:

Object:

the context of the script.

isClassComponent

(
  • comp
)
Boolean

Defined in ../src/core.js:158

Tells you if one class is a registered component class

Parameters:

  • comp ComponentClass

    component class to evaluate

Returns:

Boolean:

true if the component class is registered

registerComponent

(
  • component
  • old_classname
)

Defined in ../src/core.js:85

Register a component (or several) so it is listed when searching for new components to attach

Parameters:

  • component Component

    component class to register

  • old_classname String

    [optional] the name of the component that this class replaces (in case you are renaming it)

registerMaterialClass

(
  • comp
)

Defined in ../src/core.js:681

Register a Material class so it is listed when searching for new materials to attach

Parameters:

  • comp ComponentClass

    component class to register

registerResourceClass

(
  • c
)

Defined in ../src/core.js:256

Register a resource class so we know which classes could be use as resources

Parameters:

  • c ComponentClass

    component class to register

replaceComponentClass

(
  • scene
  • old_class_name
  • new_class_name
)
Number

Defined in ../src/core.js:171

Replaces all components of one class in the scene with components of another class

Parameters:

  • scene SceneTree

    where to apply the replace

  • old_class_name String

    name of the class to be replaced

  • new_class_name String

    name of the class that will be used instead

Returns:

Number:

the number of components replaced

reset

()

Defined in ../src/core.js:740

clears the global scene and the resources manager

safeCall

(
  • callback
  • params
  • instance
)

Defined in ../src/core.js:273

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
)

Defined in ../src/core.js:320

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 Number

    in ms

  • timer_id Number

setTimeout

(
  • callback
  • time
  • timer_id
)

Defined in ../src/core.js:298

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 Number

    in ms

  • timer_id Number

unregisterComponent

(
  • name
)

Defined in ../src/core.js:143

Unregisters a component from the system (although existing instances are kept in the scene)

Parameters:

  • name String

    the name of the component to unregister

validateName

(
  • name
)
Boolean

Defined in ../src/core.js:48

validates name string to ensure there is no forbidden characters valid characters are letters, numbers, spaces, dash, underscore and dot

Parameters:

  • name String

Returns:

Boolean:

Properties

Components

Object

Defined in ../src/core.js:76

Contains all the registered components

Default: {}

MaterialClasses

Object

Defined in ../src/core.js:672

Contains all the registered material classes

Default: {}