Detailed Description

The default script handler for Nitro.

Inheritance diagram for PowerUI.NitroScriptEngine:
PowerUI.ScriptEngine

Public Member Functions

override string[] GetTypes ()
 The meta types that your engine will handle. E.g. "text/javascript". More...
 
 NitroScriptEngine ()
 
override 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...
 
override 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...
 
- Public Member Functions inherited from PowerUI.ScriptEngine
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...
 
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

UICode CodeInstance
 An instance of the compiled code on this page. May also be null of there is no script on the page. More...
 
- Public Attributes inherited from PowerUI.ScriptEngine
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

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

Properties

override object this[string global] [get, set]
 Gets or sets script variable values. More...
 
- Properties inherited from PowerUI.ScriptEngine
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...
 

Private Attributes

NitroDomainManager SecurityDomain
 The nitro securty domain for this document. More...
 

Constructor & Destructor Documentation

PowerUI.NitroScriptEngine.NitroScriptEngine ( )
inline

Member Function Documentation

override void PowerUI.NitroScriptEngine.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 from PowerUI.ScriptEngine.

override string [] PowerUI.NitroScriptEngine.GetTypes ( )
inlinevirtual

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

Reimplemented from PowerUI.ScriptEngine.

override ScriptEngine PowerUI.NitroScriptEngine.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 from PowerUI.ScriptEngine.

override object PowerUI.NitroScriptEngine.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 from PowerUI.ScriptEngine.

Member Data Documentation

UICode PowerUI.NitroScriptEngine.CodeInstance

An instance of the compiled code on this page. May also be null of there is no script on the page.

NitroDomainManager PowerUI.NitroScriptEngine.SecurityDomain
private

The nitro securty domain for this document.

Property Documentation

override object PowerUI.NitroScriptEngine.this[string global]
getset

Gets or sets script variable values.

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