<commit_before>define(["Tone/core/Tone"], function (Tone) {

	/**
	 *  @class Tone.EventEmitter gives classes which extend it
	 *         the ability to listen for and trigger events. 
	 *         Inspiration and reference from Jerome Etienne's [MicroEvent](https://github.com/jeromeetienne/microevent.js).
	 *         MIT (c) 2011 <NAME>.
	 *         
	 *  @extends {Tone}
	 */
	Tone.EventEmitter = function(){
		/**
		 *  Contains all of the events.
		 *  @private
		 *  @type  {Object}
		 */
		this._events = {};
	};

	Tone.extend(Tone.EventEmitter);

	/**
	 *  Bind a callback to a specific event.
	 *  @param  {String}    event     The name of the event to listen for.
	 *  @param  {Function}  callback  The callback to invoke when the
	 *                                event is triggered
	 *  @return  {Tone.EventEmitter}    this
	 */
	Tone.EventEmitter.prototype.on = function(event, callback){
		//split the event
		var events = event.split(/\W+/);
		for (var i = 0; i < events.length; i++){
			var eventName = events[i];
			if (!this._events.hasOwnProperty(eventName)){
				this._events[eventName] = [];
			}
			this._events[eventName].push(callback);
		}
		return this;
	};

	/**
	 *  Remove the event listener.
	 *  @param  {String}    event     The event to stop listening to.
	 *  @param  {Function}  callback  The callback which was bound to 
	 *                                the event with Tone.EventEmitter.on.
	 *  @return  {Tone.EventEmitter}    this
	 */
	Tone.EventEmitter.prototype.off = function(event, callback){
		var events = event.split(/\W+/);
		for (var ev = 0; ev < events.length; ev++){
			event = events[ev];
			if (this._events.hasOwnProperty(event)){
				var eventList = this._events[event];
				for (var i = 0; i < eventList.length; i++){
					if (eventList[i] === callback){
						eventList.splice(i, 1);
						break;					
					}
				}
			}
		}
		return this;
	};

	/**
	 *  Invoke all of the callbacks bound to the event
	 *  with any arguments passed in. 
	 *  @param  {String}  event  The name of the event.
	 *  @param {*...} args The arguments to pass to the functions listening.
	 *  @return  {Tone.EventEmitter}  this
	 */
	Tone.EventEmitter.prototype.trigger = function(event){<commit_msg>Removes all events when no callback with `off``<commit_after>define(["Tone/core/Tone"], function (Tone) {

	/**
	 *  @class Tone.EventEmitter gives classes which extend it
	 *         the ability to listen for and trigger events. 
	 *         Inspiration and reference from <NAME>'s [MicroEvent](https://github.com/jeromeetienne/microevent.js).
	 *         MIT (c) 2011 <NAME>.
	 *         
	 *  @extends {Tone}
	 */
	Tone.EventEmitter = function(){
		/**
		 *  Contains all of the events.
		 *  @private
		 *  @type  {Object}
		 */
		this._events = {};
	};

	Tone.extend(Tone.EventEmitter);

	/**
	 *  Bind a callback to a specific event.
	 *  @param  {String}    event     The name of the event to listen for.
	 *  @param  {Function}  callback  The callback to invoke when the
	 *                                event is triggered
	 *  @return  {Tone.EventEmitter}    this
	 */
	Tone.EventEmitter.prototype.on = function(event, callback){
		//split the event
		var events = event.split(/\W+/);
		for (var i = 0; i < events.length; i++){
			var eventName = events[i];
			if (!this._events.hasOwnProperty(eventName)){
				this._events[eventName] = [];
			}
			this._events[eventName].push(callback);
		}
		return this;
	};

	/**
	 *  Remove the event listener.
	 *  @param  {String}    event     The event to stop listening to.
	 *  @param  {Function=}  callback  The callback which was bound to 
	 *                                the event with Tone.EventEmitter.on.
	 *                                If no callback is given, all callbacks
	 *                                events are removed.
	 *  @return  {Tone.EventEmitter}    this
	 */
	Tone.EventEmitter.prototype.off = function(event, callback){
		var events = event.split(/\W+/);
		for (var ev = 0; ev < events.length; ev++){
			event = events[ev];
			if (this._events.hasOwnProperty(event)){
				if (this.isUndef(callback)){
					this._events[event] = [];
				} else {
					var eventList = this._events[event];
					for (var i = 0; i < eventList.length; i++){
						if (eventList[i] === callback){
							eventList.splice(i, 1);
						}
					}
				}
			}
		}
		return this;
	};

	/**
	 *  Invoke all of the callbacks bound to the event
	 *  with any arguments passed in. 
	 *  @param  {String}  event  The name of the event.
	 *  @param {*...} args The arguments to pass to the functions listening.
	 *  @return  {Tone.EventEmitter}  this
	 */
	Tone.EventEmitter.prototype.trigger = function(event){
{'fraction_non_alphanumeric': 0.13050883542686822, 'fraction_numerical': 0.0034064296359378327, 'mean_word_length': 2.3037974683544302, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5362841', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1463, 'n_words': 422}