src/core/base/wnModule.js
function (id,onLoad)
		{
			if (_modules[id] != undefined) 
				return _modules[id];
			else if (this.hasComponent('classBuilder'))
			{
				try {
					var config = _modulesConfig[id] || {},
						modulePath = config.modulePath || id,
						className = config.class;
					if (fs.existsSync(this.modulePath+modulePath) && className != undefined)
					{
						config.id = id;
						config.autoInit = !(config.autoInit == false);
						var npmPath = [];
							for (n in self.npmPath)
								npmPath.push(self.npmPath[n]);
						npmPath.unshift(this.modulePath+modulePath+'/node_modules/');
						var module = this.createModule(className,config,modulePath,npmPath);
						if (module)
						{
							_modules[id] = module;
							this.attachModuleEvents(id);
							onLoad&&onLoad(module);
							self.e.loadModule(id,module);
							process.nextTick(function () {
								module.e.ready(modulePath,config);
							});
							return _modules[id];
						}
						return false;
					} else
						return false;
				} catch (e)
				{
					this.e.log&&
						this.e.log('wnModule.getModule: Error at loading `'+id+'`');
					this.e.exception&&
						this.e.exception(e);
				}
			}
		}
function (id,onLoad)
		{
			if (_modules[id] != undefined) 
				return _modules[id];
			else if (this.hasComponent('classBuilder'))
			{
				try {
					var config = _modulesConfig[id] || {},
						modulePath = config.modulePath || id,
						className = config.class;
					if (fs.existsSync(this.modulePath+modulePath) && className != undefined)
					{
						config.id = id;
						config.autoInit = !(config.autoInit == false);
						var npmPath = [];
							for (n in self.npmPath)
								npmPath.push(self.npmPath[n]);
						npmPath.unshift(this.modulePath+modulePath+'/node_modules/');
						var module = this.createModule(className,config,modulePath,npmPath);
						if (module)
						{
							_modules[id] = module;
							this.attachModuleEvents(id);
							onLoad&&onLoad(module);
							self.e.loadModule(id,module);
							process.nextTick(function () {
								module.e.ready(modulePath,config);
							});
							return _modules[id];
						}
						return false;
					} else
						return false;
				} catch (e)
				{
					this.e.log&&
						this.e.log('wnModule.getModule: Error at loading `'+id+'`');
					this.e.exception&&
						this.e.exception(e);
				}
			}
		}
function ( id , onLoad ) { if ( _modules [ id ] != undefined ) return _modules [ id ] ; else if ( this . hasComponent ( 'classBuilder' ) ) { try { var config = _modulesConfig [ id ] || { } , modulePath = config . modulePath || id , className = config . class ; if ( fs . existsSync ( this . modulePath + modulePath ) && className != undefined ) { config . id = id ; config . autoInit = ! ( config . autoInit == false ) ; var npmPath = [ ] ; for ( n in self . npmPath ) npmPath . push ( self . npmPath [ n ] ) ; npmPath . unshift ( this . modulePath + modulePath + '/node_modules/' ) ; var module = this . createModule ( className , config , modulePath , npmPath ) ; if ( module ) { _modules [ id ] = module ; this . attachModuleEvents ( id ) ; onLoad && onLoad ( module ) ; self . e . loadModule ( id , module ) ; process . nextTick ( function ( ) { module . e . ready ( modulePath , config ) ; } ) ; return _modules [ id ] ; } return false ; } else return false ; } catch ( e ) { this . e . log && this . e . log ( 'wnModule.getModule: Error at loading `' + id + '`' ) ; this . e . exception && this . e . exception ( e ) ; } } }
Retrieves the named application module.
The module has to be declared in the global modules list. A new instance will be created
when calling this method with the given ID for the first time.
@param string $id application module ID (case-sensitive)
@param function $onLoad function called when app loaded
@return wnModule the module instance, null if the module is disabled or does not exist.
Retrieves the named application module . The module has to be declared in the global modules list . A new instance will be created when calling this method with the given ID for the first time .