API Docs for:
Show:

LS.LS Class

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

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

///@INFO: BASE

Methods

clearUIds

(
  • root
)

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

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

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

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

Parameters:

  • target Class
  • origin Class

generateUId

() String

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

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

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

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

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

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

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

nextFrame

() Promise

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

Returns a Promise that will be fulfilled when the next frame is rendered

Returns:

Promise:

registerComponent

(
  • component
  • old_classname
)

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

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

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

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

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

Parameters:

  • scene Scene

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

clears the global scene and the resources manager

safeCall

(
  • callback
  • params
  • instance
)

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

Is a wrapper for callbacks that throws an LS "exception" in case something goes wrong (needed to catch the error from the system and editor)

Parameters:

  • callback Function
  • params Array
  • instance Object

setInterval

(
  • callback
  • time
  • timer_id
)

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

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

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

sleep

(
  • ms
)
Promise

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

Returns a Promise that will be fulfilled once the time has passed

Parameters:

  • ms Number

    time in milliseconds

Returns:

Promise:

unregisterComponent

(
  • name
)

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

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

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

Contains all the registered components

Default: {}

MaterialClasses

Object

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

Contains all the registered material classes

Default: {}