commonjs.Module Class
the module class for the commonjs to manage the modules for the application
Constructor
commonjs.Module
()
Item Index
Methods
Properties
Methods
excute
-
type=''
excute the module. because the module just was registered in module management center before excuting it.
Parameters:
-
type=''
Stringthe slogan to indicate when to excute this module, the value has 2 types: '~'/default. '~' will excute it in document.ready; and the others will be excuted right now!
Returns:
excuteit
()
Object
private
the internal implement for the method of excute. it will get all the required modules, and excute the facotry of this module. and store the result to the property exprots
Returns:
getExports
()
Object
public
it will get the export of the modules . if the factory hasn't been excuted, it will execute the factory of this module by call this.excuteit().
Returns:
getRequireList
-
list
it will get all the required modules .
Parameters:
-
list
Arraythe required modules' name of this instance
Returns:
init
-
id
-
[req]
-
factory
the initial entry for this Module,and it will be excuted immediately when the instance is created! The params are from the function of Module.createInstace(id,req,factory);
Parameters:
-
id
Stringthe module name for the instance, it should be unique and the namspace is expected like 'mywork/module1'
-
[req]
Array optionalthe required modules for this module
-
factory
Functionthe factory function for the module
Returns:
Properties
exports
Object
public
store the exports of this module
Default: null
id
String
public
the unique id for the module
Default: ''
requiredList
Array
public
store the names of all the required modules
Default: []