C# 클래스 Rhino.Commonjs.Module.Require

상속: Rhino.BaseFunction
파일 보기 프로젝트 열기: hazzik/Rhino.Net

공개 메소드들

메소드 설명
Call ( Context cx, Scriptable scope, Scriptable thisObj, object args ) : object
Construct ( Context cx, Scriptable scope, object args ) : Scriptable
GetArity ( ) : int
GetFunctionName ( ) : string
GetLength ( ) : int
Install ( Scriptable scope ) : void

Binds this instance of require() into the specified scope under the property name "require".

Binds this instance of require() into the specified scope under the property name "require".

Require ( Context cx, Scriptable nativeScope, ModuleScriptProvider moduleScriptProvider, System.Script preExec, System.Script postExec, bool sandboxed ) : System

Creates a new instance of the require() function.

Creates a new instance of the require() function. Upon constructing it, you will either want to install it in the global (or some other) scope using Install(Rhino.Scriptable) , or alternatively, you can load the program's main module using RequireMain(Rhino.Context, string) and then act on the main module's exports.

RequireMain ( Context cx, string mainModuleId ) : Scriptable

Calling this method establishes a module as being the main module of the program to which this require() instance belongs.

Calling this method establishes a module as being the main module of the program to which this require() instance belongs. The module will be loaded as if require()'d and its "module" property will be set as the "main" property of this require() instance. You have to call this method before the module has been loaded (that is, the call to this method must be the first to require the module and thus trigger its loading). Note that the main module will execute in its own scope and not in the global scope. Since all other modules see the global scope, executing the main module in the global scope would open it for tampering by other modules.

비공개 메소드들

메소드 설명
DefineReadOnlyProperty ( ScriptableObject obj, string name, object value ) : void
ExecuteModuleScript ( Context cx, string id, Scriptable exports, ModuleScript moduleScript, bool isMain ) : Scriptable
ExecuteOptionalScript ( System.Script script, Context cx, Scriptable executionScope ) : void
GetExportedModuleInterface ( Context cx, string id, Uri uri, Uri @base, bool isMain ) : Scriptable
GetModule ( Context cx, string id, Uri uri, Uri @base ) : ModuleScript

메소드 상세

Call() 공개 메소드

public Call ( Context cx, Scriptable scope, Scriptable thisObj, object args ) : object
cx Rhino.Context
scope Scriptable
thisObj Scriptable
args object
리턴 object

Construct() 공개 메소드

public Construct ( Context cx, Scriptable scope, object args ) : Scriptable
cx Rhino.Context
scope Scriptable
args object
리턴 Scriptable

GetArity() 공개 메소드

public GetArity ( ) : int
리턴 int

GetFunctionName() 공개 메소드

public GetFunctionName ( ) : string
리턴 string

GetLength() 공개 메소드

public GetLength ( ) : int
리턴 int

Install() 공개 메소드

Binds this instance of require() into the specified scope under the property name "require".
Binds this instance of require() into the specified scope under the property name "require".
public Install ( Scriptable scope ) : void
scope Scriptable the scope where the require() function is to be installed.
리턴 void

Require() 공개 메소드

Creates a new instance of the require() function.
Creates a new instance of the require() function. Upon constructing it, you will either want to install it in the global (or some other) scope using Install(Rhino.Scriptable) , or alternatively, you can load the program's main module using RequireMain(Rhino.Context, string) and then act on the main module's exports.
public Require ( Context cx, Scriptable nativeScope, ModuleScriptProvider moduleScriptProvider, System.Script preExec, System.Script postExec, bool sandboxed ) : System
cx Rhino.Context the current context
nativeScope Scriptable /// a scope that provides the standard native JavaScript /// objects. ///
moduleScriptProvider ModuleScriptProvider a provider for module scripts
preExec System.Script /// an optional script that is executed in every module's /// scope before its module script is run. ///
postExec System.Script /// an optional script that is executed in every module's /// scope after its module script is run. ///
sandboxed bool /// if set to true, the require function will be sandboxed. /// This means that it doesn't have the "paths" property, and also that the /// modules it loads don't export the "module.uri" property. ///
리턴 System

RequireMain() 공개 메소드

Calling this method establishes a module as being the main module of the program to which this require() instance belongs.
Calling this method establishes a module as being the main module of the program to which this require() instance belongs. The module will be loaded as if require()'d and its "module" property will be set as the "main" property of this require() instance. You have to call this method before the module has been loaded (that is, the call to this method must be the first to require the module and thus trigger its loading). Note that the main module will execute in its own scope and not in the global scope. Since all other modules see the global scope, executing the main module in the global scope would open it for tampering by other modules.
/// if the main module is already loaded when /// required, or if this require() instance already has a different main /// module set. ///
public RequireMain ( Context cx, string mainModuleId ) : Scriptable
cx Rhino.Context the current context
mainModuleId string the ID of the main module
리턴 Scriptable