<commit_before>/**
 * Generic non bubling event system for core classes.
 */
(function() {
	
	core.Class("lowland.base.NativeEvents", {
		members : {
			__destructableEventsList : null,
			
			/**
			 * Add event listener on @event {String} to @element {Element}. If the event is fired the
			 * @callback {Function} is executed in @context {var?null}.
			 */
			addNativeListener : function(element, event, callback, context, capture) {
				var boundCallback;
				
				var destructableEventsList = this.__destructableEventsList;
				if (!destructableEventsList) {
					destructableEventsList = this.__destructableEventsList = [];
				}
				destructableEventsList.push([element, event, callback, context, capture]);
				
				if (!context) {
					context = this;
				}
				
				lowland.bom.Events.listen(element, event, core.Function.bind(callback, context), capture);
			},
			
			/**
			 * Remove event listener on @event {String} from @element {Element} that has @callback {Function?null} and @context {var?null} given.
			 */
			removeNativeListener : function(element, event, callback, context, capture) {
				var destructableEventsList = this.__destructableEventsList;
				if (destructableEventsList) {
					for (var i=0,ii=destructableEventsList.length; i<ii; i++) {
						var evt = destructableEventsList[i];
						if (evt[0] == element && evt[1] == event && evt[2] == callback && evt[3] == context && evt[4] == capture) {
							destructableEventsList.splice(i, 1);
							break;
						}
					}
				}
				
				if (!context) {
					context = this;
				}
				
				lowland.bom.Events.unlisten(element, event, core.Function.bind(callback, context), capture);
			},
	
			destruct : function() {
				var destructableEventsList = this.__destructableEventsList;
				while (destructableEventsList && destructableEventsList.length > 0) {
					var evt = destructableEventsList[0];
					this.removeNativeListener.apply(this, evt);
				}
			},
	
			debugNativeListener : jasy.Env.isSet("debug") ? lowland.bom.Events.debugEvents : undefined
		}
	});

})();<commit_msg>Add removeAllNativeListeners<commit_after>/**
 * Generic non bubling event system for core classes.
 */
(function() {
	
	core.Class("lowland.base.NativeEvents", {
		members : {
			__destructableEventsList : null,
			
			/**
			 * Add event listener on @event {String} to @element {Element}. If the event is fired the
			 * @callback {Function} is executed in @context {var?null}.
			 */
			addNativeListener : function(element, event, callback, context, capture) {
				var boundCallback;
				
				var destructableEventsList = this.__destructableEventsList;
				if (!destructableEventsList) {
					destructableEventsList = this.__destructableEventsList = [];
				}
				destructableEventsList.push([element, event, callback, context, capture]);
				
				if (!context) {
					context = this;
				}
				
				lowland.bom.Events.listen(element, event, core.Function.bind(callback, context), capture);
			},
			
			/**
			 * Remove event listener on @event {String} from @element {Element} that has @callback {Function?null} and @context {var?null} given.
			 */
			removeNativeListener : function(element, event, callback, context, capture) {
				var destructableEventsList = this.__destructableEventsList;
				if (destructableEventsList) {
					for (var i=0,ii=destructableEventsList.length; i<ii; i++) {
						var evt = destructableEventsList[i];
						if (evt[0] == element && evt[1] == event && evt[2] == callback && evt[3] == context && evt[4] == capture) {
							destructableEventsList.splice(i, 1);
							break;
						}
					}
				}
				
				if (!context) {
					context = this;
				}
				
				lowland.bom.Events.unlisten(element, event, core.Function.bind(callback, context), capture);
			},

			removeAllNativeListeners : function() {
				var destructableEventsList = this.__destructableEventsList;
				while (destructableEventsList && destructableEventsList.length > 0) {
					var evt = destructableEventsList[0];
					this.removeNativeListener.apply(this, evt);
				}
			},
	
			destruct : function() {
				this.removeAllNativeListeners();
			},
	
			debugNativeListener : jasy.Env.isSet("debug") ? lowland.bom.Events.debugEvents : undefined
		}
	});

})();
{'fraction_non_alphanumeric': 0.1282536677709418, 'fraction_numerical': 0.004259346900141978, 'mean_word_length': 3.3487654320987654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7453447', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1235, 'n_words': 288}