Detailed Description

A particular script engine. Derive from this if you wish to create your own.

Inheritance diagram for PowerUI.ScriptEngine:
PowerUI.NitroScriptEngine

Public Member Functions

void AddCode (string code)
 Adds the given nitro code to the document. Used by script tags. Note that this will not work at runtime if the code if this document has already been compiled. More...
 
void AddCode (string code, int index)
 Adds the given Nitro code to the engine. Used by script tags. Note that this will not work at runtime if the code if this document has already been compiled. More...
 
int GetCodeIndex ()
 Gets a new code index in the CodeBuffer array. More...
 
virtual string[] GetTypes ()
 The meta types that your engine will handle. E.g. "text/javascript". More...
 
virtual ScriptEngine Instance (Document document)
 When a type of script is encountered on the document, this is called to instance a script engine. You can share a single global instance if you wish by returning this. Return null if the engine can't be used by the given document. More...
 
virtual object RunLiteral (string name, object context, object[] args, bool optional)
 Runs a nitro function by name with a set of arguments only if the method exists. More...
 
object Run (string name, params object[] args)
 Runs a nitro function by name with optional arguments. More...
 
object RunLiteral (string name, object[] args)
 Runs a nitro function by name with a set of arguments. More...
 
object RunLiteral (string name, object context, object[] args)
 Runs a nitro function by name with a set of arguments. More...
 
object RunLiteral (string name, object[] args, bool optional)
 Runs a nitro function by name with a set of arguments only if the method exists. More...
 
object RunOptionally (string name, object context, params object[] args)
 Runs a nitro function by name with a set of arguments only if the method exists. More...
 
object RunOptionally (string name, params object[] args)
 Runs a nitro function by name with a set of arguments only if the method exists. More...
 
bool TryCompile ()
 Attempts to compile the code. It's only successful if there are no nulls in the code buffer. More...
 

Public Attributes

string[] CodeBuffer
 All code in script tags is buffered and compiled in one go. This is the buffer. More...
 
Document Document
 The document this engine is for (if any). More...
 

Protected Member Functions

virtual void Compile (string code)
 Loads the given textual code for the given document. PowerUI ensures order for you including when scripts are downloaded from the internet. More...
 

Properties

HtmlDocument htmlDocument [get]
 The HTML document this engine is for (if any). More...
 
object GlobalScope [get]
 The global scripting scope. More...
 
bool AotDocument [get]
 
virtual object this[string global] [get, set]
 Gets or sets script variable values. More...
 

Member Function Documentation

void PowerUI.ScriptEngine.AddCode ( string  code)
inline

Adds the given nitro code to the document. Used by script tags. Note that this will not work at runtime if the code if this document has already been compiled.

Parameters
codeThe nitro code to add to the document.
void PowerUI.ScriptEngine.AddCode ( string  code,
int  index 
)
inline

Adds the given Nitro code to the engine. Used by script tags. Note that this will not work at runtime if the code if this document has already been compiled.

Parameters
codeThe nitro code to add to the document.
indexThe index in the code buffer to add the code into.
virtual void PowerUI.ScriptEngine.Compile ( string  code)
inlineprotectedvirtual

Loads the given textual code for the given document. PowerUI ensures order for you including when scripts are downloaded from the internet.

Reimplemented in PowerUI.NitroScriptEngine.

int PowerUI.ScriptEngine.GetCodeIndex ( )
inline

Gets a new code index in the CodeBuffer array.

Returns
A new index in the CodeBuffer array.
virtual string [] PowerUI.ScriptEngine.GetTypes ( )
inlinevirtual

The meta types that your engine will handle. E.g. "text/javascript".

Reimplemented in PowerUI.NitroScriptEngine.

virtual ScriptEngine PowerUI.ScriptEngine.Instance ( Document  document)
inlinevirtual

When a type of script is encountered on the document, this is called to instance a script engine. You can share a single global instance if you wish by returning this. Return null if the engine can't be used by the given document.

Reimplemented in PowerUI.NitroScriptEngine.

object PowerUI.ScriptEngine.Run ( string  name,
params object[]  args 
)
inline

Runs a nitro function by name with optional arguments.

Parameters
nameThe name of the function in lowercase.
argsOptional arguments to use when calling the function.
Returns
The value that the called function returned, if any.
virtual object PowerUI.ScriptEngine.RunLiteral ( string  name,
object  context,
object[]  args,
bool  optional 
)
inlinevirtual

Runs a nitro function by name with a set of arguments only if the method exists.

Parameters
nameThe name of the function in lowercase.
contextThe context to use for the 'this' value.
argsThe set of arguments to use when calling the function.
optionalTrue if the method call is optional. No exception is thrown if not found.
Returns
The value that the called function returned, if any.

Reimplemented in PowerUI.NitroScriptEngine.

object PowerUI.ScriptEngine.RunLiteral ( string  name,
object[]  args 
)
inline

Runs a nitro function by name with a set of arguments.

Parameters
nameThe name of the function in lowercase.
argsThe set of arguments to use when calling the function.
Returns
The value that the called function returned, if any.
object PowerUI.ScriptEngine.RunLiteral ( string  name,
object  context,
object[]  args 
)
inline

Runs a nitro function by name with a set of arguments.

Parameters
nameThe name of the function in lowercase.
contextThe context to use for the 'this' value.
argsThe set of arguments to use when calling the function.
Returns
The value that the called function returned, if any.
object PowerUI.ScriptEngine.RunLiteral ( string  name,
object[]  args,
bool  optional 
)
inline

Runs a nitro function by name with a set of arguments only if the method exists.

Parameters
nameThe name of the function in lowercase.
argsThe set of arguments to use when calling the function.
optionalTrue if the method call is optional. No exception is thrown if not found.
Returns
The value that the called function returned, if any.
object PowerUI.ScriptEngine.RunOptionally ( string  name,
object  context,
params object[]  args 
)
inline

Runs a nitro function by name with a set of arguments only if the method exists.

Parameters
nameThe name of the function in lowercase.
contextThe context to use for the 'this' value.
optionalTrue if the method call is optional. No exception is thrown if not found.
argsThe set of arguments to use when calling the function.
Returns
The value that the called function returned, if any.
object PowerUI.ScriptEngine.RunOptionally ( string  name,
params object[]  args 
)
inline

Runs a nitro function by name with a set of arguments only if the method exists.

Parameters
nameThe name of the function in lowercase.
optionalTrue if the method call is optional. No exception is thrown if not found.
argsThe set of arguments to use when calling the function.
Returns
The value that the called function returned, if any.
bool PowerUI.ScriptEngine.TryCompile ( )
inline

Attempts to compile the code. It's only successful if there are no nulls in the code buffer.

Returns
Returns false if we're still waiting on code to download.

Member Data Documentation

string [] PowerUI.ScriptEngine.CodeBuffer

All code in script tags is buffered and compiled in one go. This is the buffer.

Document PowerUI.ScriptEngine.Document

The document this engine is for (if any).

Property Documentation

bool PowerUI.ScriptEngine.AotDocument
get
object PowerUI.ScriptEngine.GlobalScope
get

The global scripting scope.

HtmlDocument PowerUI.ScriptEngine.htmlDocument
get

The HTML document this engine is for (if any).

virtual object PowerUI.ScriptEngine.this[string global]
getset

Gets or sets script variable values.

Parameters
indexThe name of the variable.
Returns
The variable value.