src/event-listener.js
function (eventEmitters, eventNames, callback, context, useCapture) {
				if (RUNTIME_CHECKS) {
					if (!eventEmitters || !(eventEmitters.addEventListener || eventEmitters instanceof Array)) {
						throw '"eventEmitters" argument must be an event emitter or an array of event emitters';
					}
					if (typeof eventNames !== 'string' && !(eventNames instanceof Array)) {
						throw '"eventNames" argument must be a string or an array of strings';
					}
					if (typeof callback !== 'function') {
						throw '"callback" argument must be a function';
					}
					if (arguments.length > 4 && typeof useCapture !== 'boolean') {
						throw '"useCapture" argument must be a boolean value';
					}
				}

				// Convenience functionality that allows you to listen to all items in an Array or NodeList
				// BFF Lists have this kind of functionality built it, so don't handle that case here
				eventEmitters = eventEmitters instanceof Array ||
						(typeof NodeList !== 'undefined' && eventEmitters instanceof NodeList) ? eventEmitters : [ eventEmitters ];

				eventNames = eventNames instanceof Array ? eventNames : [ eventNames ];

				for (var i = 0; i < eventEmitters.length; ++i) {
					for (var j = 0; j < eventNames.length; ++j) {
						setupListeners(this, eventEmitters[i], eventNames[j], callback, context, !!useCapture);
					}
				}
			}
function (eventEmitters, eventNames, callback, context, useCapture) {
				if (RUNTIME_CHECKS) {
					if (!eventEmitters || !(eventEmitters.addEventListener || eventEmitters instanceof Array)) {
						throw '"eventEmitters" argument must be an event emitter or an array of event emitters';
					}
					if (typeof eventNames !== 'string' && !(eventNames instanceof Array)) {
						throw '"eventNames" argument must be a string or an array of strings';
					}
					if (typeof callback !== 'function') {
						throw '"callback" argument must be a function';
					}
					if (arguments.length > 4 && typeof useCapture !== 'boolean') {
						throw '"useCapture" argument must be a boolean value';
					}
				}

				// Convenience functionality that allows you to listen to all items in an Array or NodeList
				// BFF Lists have this kind of functionality built it, so don't handle that case here
				eventEmitters = eventEmitters instanceof Array ||
						(typeof NodeList !== 'undefined' && eventEmitters instanceof NodeList) ? eventEmitters : [ eventEmitters ];

				eventNames = eventNames instanceof Array ? eventNames : [ eventNames ];

				for (var i = 0; i < eventEmitters.length; ++i) {
					for (var j = 0; j < eventNames.length; ++j) {
						setupListeners(this, eventEmitters[i], eventNames[j], callback, context, !!useCapture);
					}
				}
			}
function ( eventEmitters , eventNames , callback , context , useCapture ) { if ( RUNTIME_CHECKS ) { if ( ! eventEmitters || ! ( eventEmitters . addEventListener || eventEmitters instanceof Array ) ) { throw '"eventEmitters" argument must be an event emitter or an array of event emitters' ; } if ( typeof eventNames !== 'string' && ! ( eventNames instanceof Array ) ) { throw '"eventNames" argument must be a string or an array of strings' ; } if ( typeof callback !== 'function' ) { throw '"callback" argument must be a function' ; } if ( arguments . length > 4 && typeof useCapture !== 'boolean' ) { throw '"useCapture" argument must be a boolean value' ; } } // Convenience functionality that allows you to listen to all items in an Array or NodeList // BFF Lists have this kind of functionality built it, so don't handle that case here eventEmitters = eventEmitters instanceof Array || ( typeof NodeList !== 'undefined' && eventEmitters instanceof NodeList ) ? eventEmitters : [ eventEmitters ] ; eventNames = eventNames instanceof Array ? eventNames : [ eventNames ] ; for ( var i = 0 ; i < eventEmitters . length ; ++ i ) { for ( var j = 0 ; j < eventNames . length ; ++ j ) { setupListeners ( this , eventEmitters [ i ] , eventNames [ j ] , callback , context , ! ! useCapture ) ; } } }
Start listening to an event on a specified event emitting object. Both eventEmitters and eventNames arguments can be arrays. The total amount of listeners added will be the Cartesian product of the two lists.
@instance
@arg {Object|Array|NodeList} eventEmitters - One or more event emitters that will be listened to.
@arg {string|Array} eventNames - One or more string identifiers for events that will be listented to.
@arg {function} callback - The function that will be called when the event is emitted.
@arg {any} [context] - The context with which the callback will be called (i.e. what "this" will be).
Will default to the caller of .listenTo, if not provided.
Start listening to an event on a specified event emitting object . Both eventEmitters and eventNames arguments can be arrays . The total amount of listeners added will be the Cartesian product of the two lists .