API Docs for:
Show:

LS.Components.Script Class

Module: LS

Script must be coded in Javascript and they have full access to all the engine, so one script could replace the behaviour of any part of the engine. Scripts are executed inside their own context, the context is local to the script so any variable defined in the context that is not attached to the context wont be accessible from other parts of the engine. To interact with the engine Scripts must bind callback to events so the callbacks will be called when those events are triggered, however, there are some generic methods that will be called

Constructor

LS.Components.Script

(
  • object
)

Parameters:

  • object Object

    to configure from

Methods

hookEvents

()

This check if the context has API functions that should be called, if thats the case, it binds events automatically This way we dont have to bind manually all the methods.

onScriptEvent

()

Called every time an event should be redirected to one function in the script context

processCode

()

This is the method in charge of compiling the code and executing the constructor, which also creates the context. It is called everytime the code is modified, that implies that the context is created when the component is configured.

reload

()

Force to reevaluate the code (only for special situations)

reload

(
  • [on_complete=null]
)

Force to reevaluate the code (only for special situations like remove codes)

Parameters:

  • [on_complete=null] Function optional