src/event-emitter.js
function (eventName, callback) {
				if (RUNTIME_CHECKS) {
					if (typeof eventName !== 'string') {
						throw '"eventName" argument must be a string';
					}
					if (arguments.length === 2 && typeof callback !== 'function') {
						throw '"callback" argument must be a function'; // Catch a common cause of errors
					}
				}

				// No listeners at all? We are done.
				if (!this.__private || !this.__private.listeners) { return; }

				var listenersForEvent = this.__private.listeners[eventName];
				if (!listenersForEvent) { return; } // No listeners for this event? We are done.

				if (callback) {
					var pos = listenersForEvent.indexOf(callback);
					if (pos === -1) { return; }
					listenersForEvent.splice(pos, 1);
				} else {
					listenersForEvent.length = 0;
				}
				listenersForEvent.length === 0 && (delete this.__private.listeners[eventName]);
			}
function (eventName, callback) {
				if (RUNTIME_CHECKS) {
					if (typeof eventName !== 'string') {
						throw '"eventName" argument must be a string';
					}
					if (arguments.length === 2 && typeof callback !== 'function') {
						throw '"callback" argument must be a function'; // Catch a common cause of errors
					}
				}

				// No listeners at all? We are done.
				if (!this.__private || !this.__private.listeners) { return; }

				var listenersForEvent = this.__private.listeners[eventName];
				if (!listenersForEvent) { return; } // No listeners for this event? We are done.

				if (callback) {
					var pos = listenersForEvent.indexOf(callback);
					if (pos === -1) { return; }
					listenersForEvent.splice(pos, 1);
				} else {
					listenersForEvent.length = 0;
				}
				listenersForEvent.length === 0 && (delete this.__private.listeners[eventName]);
			}
function ( eventName , callback ) { if ( RUNTIME_CHECKS ) { if ( typeof eventName !== 'string' ) { throw '"eventName" argument must be a string' ; } if ( arguments . length === 2 && typeof callback !== 'function' ) { throw '"callback" argument must be a function' ; // Catch a common cause of errors } } // No listeners at all? We are done. if ( ! this . __private || ! this . __private . listeners ) { return ; } var listenersForEvent = this . __private . listeners [ eventName ] ; if ( ! listenersForEvent ) { return ; } // No listeners for this event? We are done. if ( callback ) { var pos = listenersForEvent . indexOf ( callback ) ; if ( pos === - 1 ) { return ; } listenersForEvent . splice ( pos , 1 ) ; } else { listenersForEvent . length = 0 ; } listenersForEvent . length === 0 && ( delete this . __private . listeners [ eventName ] ) ; }
Removes an event listener function. If the function was never a listener, do nothing.
@instance
@arg {string} eventName - Identifier string for the event in question.
@arg {function} [callback] - If not given, all event listeners to the provided eventName will be removed. If given, only the given callback will be removed from the given eventName.
Removes an event listener function . If the function was never a listener do nothing .