<commit_before>var EventLoop = function EventLoop() {
  this.callback = {}; 
  this.events = [];
}

EventLoop.prototype.on = function on(evt, callback) {
  if (this.callback[evt]) {
    var oldCb = this.callback[evt]; 
    this.callback[evt] = function() {
      callback(); 
      oldCb();
    };
  } 
  else 
  {
    this.callback[evt] = callback;
  }
}

EventLoop.prototype.trigger = function trigger(evt) {
  this.events.push(evt); 
  if (!this.started) {
    this.start();
  }
}

EventLoop.prototype.start = function start() {
  while (this.events.length > 0) {
    this.started = true; 
    var evt = this.events.shift(); 
    this.callback[evt]();
  } 
  this.started = false;
}<commit_msg>Clean up callback logic<commit_after>var EventLoop = function EventLoop() {
  this.callbacks = {}; 
  this.events = [];
}

EventLoop.prototype.on = function on(evt, callback) {
  if (this.callbacks[evt]) {
    var oldCb = this.callbacks[evt]; 
    this.callbacks[evt] = function() {
      callback(); 
      oldCb();
    };
    return;
  }
  
  this.callbacks[evt] = callback;
}

EventLoop.prototype.trigger = function trigger(evt) {
  this.events.push(evt); 
  if (!this.started) {
    this.start();
  }
}

EventLoop.prototype.start = function start() {
  while (this.events.length > 0) {
    this.started = true; 
    var evt = this.events.shift(); 
    this.callbacks[evt]();
  } 
  this.started = false;
}
{'fraction_non_alphanumeric': 0.16145092460881935, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 2.9192200557103063, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3052723', 'n_tokens_mistral': 503, 'n_tokens_neox': 495, 'n_words': 89}