src/core/base/wnModule.js
function (id) {
			if (!_.isString(id))
				return false;

			var module = this.getModule(id),
				events;
			this.e.log&&this.e.log("Attaching module's events...",'system');
			if (module != undefined && (events=module.getEvents()) && !_.isEmpty(events)) {
				for (e in events)
				{
					var evtConfig = {},
						eventName = 'module.'+e.split('-').pop(),
						evtCnf = events[e].getConfig(),
						event = events[e],
						eventClass;

					if (!this.hasEvent(eventName) && evtCnf.bubble && e.indexOf('event-module') == -1)
					{
						evtConfig[eventName]=_.merge({},evtCnf);
						evtConfig[eventName].listenEvent=null;
						evtConfig[eventName].handler=null;
						this.setEvents(evtConfig);
						this.getEvent(eventName);
					}

					if (this.hasEvent(eventName) && e.indexOf('event-module') == -1)
					{
						eventClass = this.getEvent(eventName);
						event.prependListener(function (e) {
							if (typeof e == 'object'
								&& e.stopPropagation == true)
										return false;
							eventClass.emit.apply(eventClass,arguments);
						});
					}

				}
				this.attachEventsHandlers();
			}
			return this;
		}
function (id) {
			if (!_.isString(id))
				return false;

			var module = this.getModule(id),
				events;
			this.e.log&&this.e.log("Attaching module's events...",'system');
			if (module != undefined && (events=module.getEvents()) && !_.isEmpty(events)) {
				for (e in events)
				{
					var evtConfig = {},
						eventName = 'module.'+e.split('-').pop(),
						evtCnf = events[e].getConfig(),
						event = events[e],
						eventClass;

					if (!this.hasEvent(eventName) && evtCnf.bubble && e.indexOf('event-module') == -1)
					{
						evtConfig[eventName]=_.merge({},evtCnf);
						evtConfig[eventName].listenEvent=null;
						evtConfig[eventName].handler=null;
						this.setEvents(evtConfig);
						this.getEvent(eventName);
					}

					if (this.hasEvent(eventName) && e.indexOf('event-module') == -1)
					{
						eventClass = this.getEvent(eventName);
						event.prependListener(function (e) {
							if (typeof e == 'object'
								&& e.stopPropagation == true)
										return false;
							eventClass.emit.apply(eventClass,arguments);
						});
					}

				}
				this.attachEventsHandlers();
			}
			return this;
		}
function ( id ) { if ( ! _ . isString ( id ) ) return false ; var module = this . getModule ( id ) , events ; this . e . log && this . e . log ( "Attaching module's events..." , 'system' ) ; if ( module != undefined && ( events = module . getEvents ( ) ) && ! _ . isEmpty ( events ) ) { for ( e in events ) { var evtConfig = { } , eventName = 'module.' + e . split ( '-' ) . pop ( ) , evtCnf = events [ e ] . getConfig ( ) , event = events [ e ] , eventClass ; if ( ! this . hasEvent ( eventName ) && evtCnf . bubble && e . indexOf ( 'event-module' ) == - 1 ) { evtConfig [ eventName ] = _ . merge ( { } , evtCnf ) ; evtConfig [ eventName ] . listenEvent = null ; evtConfig [ eventName ] . handler = null ; this . setEvents ( evtConfig ) ; this . getEvent ( eventName ) ; } if ( this . hasEvent ( eventName ) && e . indexOf ( 'event-module' ) == - 1 ) { eventClass = this . getEvent ( eventName ) ; event . prependListener ( function ( e ) { if ( typeof e == 'object' && e . stopPropagation == true ) return false ; eventClass . emit . apply ( eventClass , arguments ) ; } ) ; } } this . attachEventsHandlers ( ) ; } return this ; }
Attach to this module all bubble-events from loaded modules
This create a Bubble-Event to answer to each event that bubles from the module's modules.
Also attach to all modules' events and handler to dispatch the event.
@param string $id source module id
Attach to this module all bubble - events from loaded modules This create a Bubble - Event to answer to each event that bubles from the module s modules . Also attach to all modules events and handler to dispatch the event .