ScriptComponent

Overview

Base class for the EcmaScript component. There's currently only 1 subclass of this. This class holds all the functionality needed to set a script, load it, run it and to debug it.

Location


 

constructor

 

constructor

 

ScriptComponent()

 

Sub New()

CallStack

Holds the current callstack, only gets loaded when Debug is true.

 

property CallStack: ReadOnlyCollection<ScriptStackFrame> read;

 

ReadOnlyCollection<ScriptStackFrame> CallStack { get; }

 

ReadOnly Property CallStack() As ReadOnlyCollection<ScriptStackFrame>

Clear

Remove the script state and optionally reset the globals.

 

method Clear(aGlobals: Boolean)

 

void Clear(Boolean aGlobals)

 

Sub Clear(aGlobals As Boolean)

Parameters:

  • aGlobals:

Debug

If true, the engine places debug instructions in the compiled scripts and enables the debugging features.

 

property Debug: Boolean read write;

 

Boolean Debug { get; set; }

 

Property Debug() As Boolean

DebugDebugger

Called when a code breakpoint is triggered. Like an EcmaScript "debugger;" statement.

 

event DebugDebugger: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugDebugger()

 

Event DebugDebugger As EventHandler<ScriptDebugEventArgs>

DebugException

Called when an Exception occurs in the engine. Only works when Debug = true.

 

event DebugException: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugException()

 

Event DebugException As EventHandler<ScriptDebugEventArgs>

DebugExceptionUnwind

Called when an Exception occurs in the engine and isn't caught. Only works when Debug = true.

 

event DebugExceptionUnwind: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugExceptionUnwind()

 

Event DebugExceptionUnwind As EventHandler<ScriptDebugEventArgs>

DebugFrameEnter

Called when a function is entered. Only works when Debug = true.

 

event DebugFrameEnter: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugFrameEnter()

 

Event DebugFrameEnter As EventHandler<ScriptDebugEventArgs>

DebugFrameExit

Called when a function is exited. Only works when Debug = true.

 

event DebugFrameExit: EventHandler<ScriptDebugExitScopeEventArgs>;

 

delegate EventHandler<ScriptDebugExitScopeEventArgs> DebugFrameExit()

 

Event DebugFrameExit As EventHandler<ScriptDebugExitScopeEventArgs>

DebugLastPos

Contains the last source location.

 

property DebugLastPos: PositionPair read;

 

PositionPair DebugLastPos { get; }

 

ReadOnly Property DebugLastPos() As PositionPair

DebugThreadExit

 

event DebugThreadExit: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugThreadExit()

 

Event DebugThreadExit As EventHandler<ScriptDebugEventArgs>

DebugTracePoint

Called when the engine is at a source line. Only works when Debug = true.

 

event DebugTracePoint: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugTracePoint()

 

Event DebugTracePoint As EventHandler<ScriptDebugEventArgs>

Dispose

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

ExposeType

Expose a type to the engine so it can be used. Name is the name it will be available under.

 

method ExposeType(type: Type; name: String)

 

void ExposeType(Type type, String name)

 

Sub ExposeType(type As Type, name As String)

Parameters:

  • type:
  • name:

Globals

Contains the custom global variables in the engine (would not contain any runtime library functions or classes).

 

property Globals: ScriptScope read;

 

ScriptScope Globals { get; }

 

ReadOnly Property Globals() As ScriptScope

HasFunction

Returns true if there is a function by that name.

 

method HasFunction(aName: String): Boolean

 

Boolean HasFunction(String aName)

 

Function HasFunction(aName As String) As Boolean

Parameters:

  • aName:

IntRun  protected

 

method IntRun: Object

 

Object IntRun()

 

Function IntRun() As Object

NonThreadedIdle

Called when the engine is waiting to be resumed, when it's paused. When RunInThread is false, this can be used to handle windows messages. Only works when Debug = true.

 

event NonThreadedIdle: EventHandler;

 

delegate EventHandler NonThreadedIdle()

 

Event NonThreadedIdle As EventHandler

Pause

Pause the engine (only works if Debug is true).

 

method Pause

 

void Pause()

 

Sub Pause()

Run

Run the current script.

 

method Run

 

void Run()

 

Sub Run()

RunException

This field contains the exception object that escaped the engine after the last run.

 

property RunException: Exception read write;

 

Exception RunException { get; set; }

 

Property RunException() As Exception

RunFunction (ScriptStatus, String, array of Object): Object

Run a function by it's name. Returns the result of the function if any. The function must exist, if not an exception is thrown. The aInitialStatus parameter is used for debugging, to step into a function or just run it.

 

method RunFunction(initialStatus: ScriptStatus; name: String; params args: array of Object): Object

 

Object RunFunction(ScriptStatus initialStatus, String name, params Object[] args)

 

Function RunFunction(initialStatus As ScriptStatus, name As String, ParamArray args As Object()) As Object

Parameters:

  • initialStatus:
  • name:
  • args:

RunFunction (String, array of Object): Object

Run a function by it's name. Returns the result of the function if any. The function must exist, if not an exception is thrown.

 

method RunFunction(name: String; params args: array of Object): Object

 

Object RunFunction(String name, params Object[] args)

 

Function RunFunction(name As String, ParamArray args As Object()) As Object

Parameters:

  • name:
  • args:

RunInThread

If true, the Run method starts a new thread and runs the script there, else Run blocks.

 

property RunInThread: Boolean read write;

 

Boolean RunInThread { get; set; }

 

Property RunInThread() As Boolean

RunResult

Contains the result of running the script. For EcmaScript this is the last expression.

 

property RunResult: Object read;

 

Object RunResult { get; }

 

ReadOnly Property RunResult() As Object

SetDebug  protected

 

method SetDebug(b: Boolean)

 

void SetDebug(Boolean b)

 

Sub SetDebug(b As Boolean)

Parameters:

  • b:

Source

Source of the script you want to run.

 

property Source: String read write;

 

String Source { get; set; }

 

Property Source() As String

SourceFileName

Source file name of the script. This is used in error messages to denote where the errors are.

 

property SourceFileName: String read write;

 

String SourceFileName { get; set; }

 

Property SourceFileName() As String

Status

Holds the current status of the engine.

 

property Status: ScriptStatus read write;

 

ScriptStatus Status { get; set; }

 

Property Status() As ScriptStatus

StatusChanged

Triggered when the Status property is changed.

 

event StatusChanged: EventHandler;

 

delegate EventHandler StatusChanged()

 

Event StatusChanged As EventHandler

StepInto

Step into the next function call (if any, else steps over it). Only works if Debug = true.

 

method StepInto

 

void StepInto()

 

Sub StepInto()

StepOut

Step out of the current function. Only works if Debug = true.

 

method StepOut

 

void StepOut()

 

Sub StepOut()

StepOver

Step over the next function call. Only works if Debug = true.

 

method StepOver

 

void StepOver()

 

Sub StepOver()

Stop

Stop the engine.

 

method Stop

 

void Stop()

 

Sub Stop()

 

CallStack

Holds the current callstack, only gets loaded when Debug is true.

 

property CallStack: ReadOnlyCollection<ScriptStackFrame> read;

 

ReadOnlyCollection<ScriptStackFrame> CallStack { get; }

 

ReadOnly Property CallStack() As ReadOnlyCollection<ScriptStackFrame>

Debug

If true, the engine places debug instructions in the compiled scripts and enables the debugging features.

 

property Debug: Boolean read write;

 

Boolean Debug { get; set; }

 

Property Debug() As Boolean

DebugLastPos

Contains the last source location.

 

property DebugLastPos: PositionPair read;

 

PositionPair DebugLastPos { get; }

 

ReadOnly Property DebugLastPos() As PositionPair

Globals

Contains the custom global variables in the engine (would not contain any runtime library functions or classes).

 

property Globals: ScriptScope read;

 

ScriptScope Globals { get; }

 

ReadOnly Property Globals() As ScriptScope

RunException

This field contains the exception object that escaped the engine after the last run.

 

property RunException: Exception read write;

 

Exception RunException { get; set; }

 

Property RunException() As Exception

RunInThread

If true, the Run method starts a new thread and runs the script there, else Run blocks.

 

property RunInThread: Boolean read write;

 

Boolean RunInThread { get; set; }

 

Property RunInThread() As Boolean

RunResult

Contains the result of running the script. For EcmaScript this is the last expression.

 

property RunResult: Object read;

 

Object RunResult { get; }

 

ReadOnly Property RunResult() As Object

Source

Source of the script you want to run.

 

property Source: String read write;

 

String Source { get; set; }

 

Property Source() As String

SourceFileName

Source file name of the script. This is used in error messages to denote where the errors are.

 

property SourceFileName: String read write;

 

String SourceFileName { get; set; }

 

Property SourceFileName() As String

Status

Holds the current status of the engine.

 

property Status: ScriptStatus read write;

 

ScriptStatus Status { get; set; }

 

Property Status() As ScriptStatus

 

constructor

 

constructor

 

ScriptComponent()

 

Sub New()

Clear

Remove the script state and optionally reset the globals.

 

method Clear(aGlobals: Boolean)

 

void Clear(Boolean aGlobals)

 

Sub Clear(aGlobals As Boolean)

Parameters:

  • aGlobals:

Dispose

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

ExposeType

Expose a type to the engine so it can be used. Name is the name it will be available under.

 

method ExposeType(type: Type; name: String)

 

void ExposeType(Type type, String name)

 

Sub ExposeType(type As Type, name As String)

Parameters:

  • type:
  • name:

HasFunction

Returns true if there is a function by that name.

 

method HasFunction(aName: String): Boolean

 

Boolean HasFunction(String aName)

 

Function HasFunction(aName As String) As Boolean

Parameters:

  • aName:

IntRun  protected

 

method IntRun: Object

 

Object IntRun()

 

Function IntRun() As Object

Pause

Pause the engine (only works if Debug is true).

 

method Pause

 

void Pause()

 

Sub Pause()

Run

Run the current script.

 

method Run

 

void Run()

 

Sub Run()

RunFunction (ScriptStatus, String, array of Object): Object

Run a function by it's name. Returns the result of the function if any. The function must exist, if not an exception is thrown. The aInitialStatus parameter is used for debugging, to step into a function or just run it.

 

method RunFunction(initialStatus: ScriptStatus; name: String; params args: array of Object): Object

 

Object RunFunction(ScriptStatus initialStatus, String name, params Object[] args)

 

Function RunFunction(initialStatus As ScriptStatus, name As String, ParamArray args As Object()) As Object

Parameters:

  • initialStatus:
  • name:
  • args:

RunFunction (String, array of Object): Object

Run a function by it's name. Returns the result of the function if any. The function must exist, if not an exception is thrown.

 

method RunFunction(name: String; params args: array of Object): Object

 

Object RunFunction(String name, params Object[] args)

 

Function RunFunction(name As String, ParamArray args As Object()) As Object

Parameters:

  • name:
  • args:

SetDebug  protected

 

method SetDebug(b: Boolean)

 

void SetDebug(Boolean b)

 

Sub SetDebug(b As Boolean)

Parameters:

  • b:

StepInto

Step into the next function call (if any, else steps over it). Only works if Debug = true.

 

method StepInto

 

void StepInto()

 

Sub StepInto()

StepOut

Step out of the current function. Only works if Debug = true.

 

method StepOut

 

void StepOut()

 

Sub StepOut()

StepOver

Step over the next function call. Only works if Debug = true.

 

method StepOver

 

void StepOver()

 

Sub StepOver()

Stop

Stop the engine.

 

method Stop

 

void Stop()

 

Sub Stop()

 

DebugDebugger

Called when a code breakpoint is triggered. Like an EcmaScript "debugger;" statement.

 

event DebugDebugger: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugDebugger()

 

Event DebugDebugger As EventHandler<ScriptDebugEventArgs>

DebugException

Called when an Exception occurs in the engine. Only works when Debug = true.

 

event DebugException: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugException()

 

Event DebugException As EventHandler<ScriptDebugEventArgs>

DebugExceptionUnwind

Called when an Exception occurs in the engine and isn't caught. Only works when Debug = true.

 

event DebugExceptionUnwind: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugExceptionUnwind()

 

Event DebugExceptionUnwind As EventHandler<ScriptDebugEventArgs>

DebugFrameEnter

Called when a function is entered. Only works when Debug = true.

 

event DebugFrameEnter: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugFrameEnter()

 

Event DebugFrameEnter As EventHandler<ScriptDebugEventArgs>

DebugFrameExit

Called when a function is exited. Only works when Debug = true.

 

event DebugFrameExit: EventHandler<ScriptDebugExitScopeEventArgs>;

 

delegate EventHandler<ScriptDebugExitScopeEventArgs> DebugFrameExit()

 

Event DebugFrameExit As EventHandler<ScriptDebugExitScopeEventArgs>

DebugThreadExit

 

event DebugThreadExit: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugThreadExit()

 

Event DebugThreadExit As EventHandler<ScriptDebugEventArgs>

DebugTracePoint

Called when the engine is at a source line. Only works when Debug = true.

 

event DebugTracePoint: EventHandler<ScriptDebugEventArgs>;

 

delegate EventHandler<ScriptDebugEventArgs> DebugTracePoint()

 

Event DebugTracePoint As EventHandler<ScriptDebugEventArgs>

NonThreadedIdle

Called when the engine is waiting to be resumed, when it's paused. When RunInThread is false, this can be used to handle windows messages. Only works when Debug = true.

 

event NonThreadedIdle: EventHandler;

 

delegate EventHandler NonThreadedIdle()

 

Event NonThreadedIdle As EventHandler

StatusChanged

Triggered when the Status property is changed.

 

event StatusChanged: EventHandler;

 

delegate EventHandler StatusChanged()

 

Event StatusChanged As EventHandler