src/Emitter.js
function off(eventIdentifier, callback, context) {
		// not initialised - so no listeners of any kind
		if (this._emitterListeners == null) { return false; }

		if (arguments.length === 0) {
			// clear all listeners.
			if (this._emitterMetaEventsOn === true) {
				var allListeners = this._emitterListeners.getValues();
				notifyRemoves(this, allListeners);
			}
			this._emitterListeners.clear();
			return true;
		} else if (arguments.length === 1) {
			// clear all listeners for a particular eventIdentifier.
			if (this._emitterListeners.hasAny(eventIdentifier)) {
				var listeners = this._emitterListeners.getValues(eventIdentifier);
				this._emitterListeners['delete'](eventIdentifier);
				if (this._emitterMetaEventsOn === true) {
					notifyRemoves(this, listeners);
				}
				return true;
			}
			return false;
		} else if (eventIdentifier === null && callback === null) {
			// clear all listeners for a particular context.
			return this.clearListeners(context);
		} else {
			// clear a specific listener.
			if (typeof callback !== 'function') { throw new TypeError('off: Illegal Argument: callback must be a function, was ' + (typeof callback)); }

			var removedAListener = this._emitterListeners.removeLastMatch(eventIdentifier, function(record) {
				var callbackToCompare = record.callback._onceFunctionMarker === ONCE_FUNCTION_MARKER ? record.callback._wrappedCallback : record.callback;
				var callbackMatches = callback === callbackToCompare;
				var contextMatches = record.registeredContext === context;
				return callbackMatches && contextMatches;
			});

			if (removedAListener && this._emitterMetaEventsOn === true) {
				this.trigger(new metaEvents.RemoveListenerEvent(eventIdentifier, callback, context));
			}
			return removedAListener;
		}
	}
function off(eventIdentifier, callback, context) {
		// not initialised - so no listeners of any kind
		if (this._emitterListeners == null) { return false; }

		if (arguments.length === 0) {
			// clear all listeners.
			if (this._emitterMetaEventsOn === true) {
				var allListeners = this._emitterListeners.getValues();
				notifyRemoves(this, allListeners);
			}
			this._emitterListeners.clear();
			return true;
		} else if (arguments.length === 1) {
			// clear all listeners for a particular eventIdentifier.
			if (this._emitterListeners.hasAny(eventIdentifier)) {
				var listeners = this._emitterListeners.getValues(eventIdentifier);
				this._emitterListeners['delete'](eventIdentifier);
				if (this._emitterMetaEventsOn === true) {
					notifyRemoves(this, listeners);
				}
				return true;
			}
			return false;
		} else if (eventIdentifier === null && callback === null) {
			// clear all listeners for a particular context.
			return this.clearListeners(context);
		} else {
			// clear a specific listener.
			if (typeof callback !== 'function') { throw new TypeError('off: Illegal Argument: callback must be a function, was ' + (typeof callback)); }

			var removedAListener = this._emitterListeners.removeLastMatch(eventIdentifier, function(record) {
				var callbackToCompare = record.callback._onceFunctionMarker === ONCE_FUNCTION_MARKER ? record.callback._wrappedCallback : record.callback;
				var callbackMatches = callback === callbackToCompare;
				var contextMatches = record.registeredContext === context;
				return callbackMatches && contextMatches;
			});

			if (removedAListener && this._emitterMetaEventsOn === true) {
				this.trigger(new metaEvents.RemoveListenerEvent(eventIdentifier, callback, context));
			}
			return removedAListener;
		}
	}
function off ( eventIdentifier , callback , context ) { // not initialised - so no listeners of any kind if ( this . _emitterListeners == null ) { return false ; } if ( arguments . length === 0 ) { // clear all listeners. if ( this . _emitterMetaEventsOn === true ) { var allListeners = this . _emitterListeners . getValues ( ) ; notifyRemoves ( this , allListeners ) ; } this . _emitterListeners . clear ( ) ; return true ; } else if ( arguments . length === 1 ) { // clear all listeners for a particular eventIdentifier. if ( this . _emitterListeners . hasAny ( eventIdentifier ) ) { var listeners = this . _emitterListeners . getValues ( eventIdentifier ) ; this . _emitterListeners [ 'delete' ] ( eventIdentifier ) ; if ( this . _emitterMetaEventsOn === true ) { notifyRemoves ( this , listeners ) ; } return true ; } return false ; } else if ( eventIdentifier === null && callback === null ) { // clear all listeners for a particular context. return this . clearListeners ( context ) ; } else { // clear a specific listener. if ( typeof callback !== 'function' ) { throw new TypeError ( 'off: Illegal Argument: callback must be a function, was ' + ( typeof callback ) ) ; } var removedAListener = this . _emitterListeners . removeLastMatch ( eventIdentifier , function ( record ) { var callbackToCompare = record . callback . _onceFunctionMarker === ONCE_FUNCTION_MARKER ? record . callback . _wrappedCallback : record . callback ; var callbackMatches = callback === callbackToCompare ; var contextMatches = record . registeredContext === context ; return callbackMatches && contextMatches ; } ) ; if ( removedAListener && this . _emitterMetaEventsOn === true ) { this . trigger ( new metaEvents . RemoveListenerEvent ( eventIdentifier , callback , context ) ) ; } return removedAListener ; } }
Clear previously registered listeners.

With no arguments, this clears all listeners from this Emitter.

With one argument, this clears all listeners registered to a particular event.

With two or three arguments, this clears a specific listener.

@param {?*} eventIdentifier The identifier of the event to clear. If null, it will clear all events.
@param {?function} callback The callback function to clear.
@param {?Object} context The context object for the callback.
@returns {boolean} true if any listeners were removed.  This is not finalised yet and may change (particularly if we want to enable chaining).
Clear previously registered listeners .