API Docs for:
Show:

LS.LS Class

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

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

Methods

clearUIds

(
  • root
)

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

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:292

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:257

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

Parameters:

  • target Class
  • origin Class

generateUId

() String

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

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:488

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:463

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:513

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:643

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:120

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

(
  • c
)

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

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

Parameters:

  • c ComponentClass

    component class to register

registerMaterialClass

(
  • comp
)

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

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:171

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
)

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

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

reset

()

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

clears the global scene and the resources manager

safeCall

(
  • callback
  • params
  • instance
)

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

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:235

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:213

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

validateName

(
  • name
)
Boolean

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

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:75

Contains all the registered components

Default: {}

MaterialClasses

Object

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

Contains all the registered material classes

Default: {}