<commit_before>'use strict'

class EventEmitter {
  constructor(name) {
    this.eventName = name;
    this.target = [];
    
  }

  emit(msg) {
    for (let i = 0; i < this.target.length; i++) {
      this.target[i]._events[this.eventName] += msg;
    }
  }
}

class EventListener {
  constructor() {
    Object.defineProperty(this, '_events', {
      configurable: true,
      enumerable: false,
      value: {},
      writable: false
    });
  }

  on(eventName, eventEmitter, handler) {
    eventEmitter = eventEmitter || new EventEmitter();
    eventEmitter.target.push(this);
    let that = this;
    Object.defineProperty(this._events, eventName, {
      configurable: true,
    set: (v) => {
      setTimeout(() => {
        handler.call(that);
      }, 0);
      }
    });
  }
}<commit_msg>Update event.js<commit_after>'use strict'

class EventEmitter {
  constructor(name) {
    this.eventName = name;
    this.targets = [];
    
  }

  emit(msg) {
    for (let i = 0; i < this.targets.length; i++) {
      this.targets[i]._events[this.eventName] = msg;
    }
  }
}

class EventListener {
  constructor() {
    Object.defineProperty(this, '_events', {
      configurable: true,
      enumerable: false,
      value: {},
      writable: false
    });
  }

  on(eventName, eventEmitter, handler) {
    eventEmitter = eventEmitter || new EventEmitter();
    if (eventEmitter.targets.indexOf(this) === -1) {
      eventEmitter.targets.push(this);
    }
    let that = this;
    Object.defineProperty(this._events, eventName, {
      configurable: true,
      set: (v) => {
        setTimeout(() => {
          handler.call(that);
        }, 0);
      }
    });
    return eventEmitter;
  }
}
{'fraction_non_alphanumeric': 0.1502651738361815, 'fraction_numerical': 0.0029463759575721863, 'mean_word_length': 2.4096385542168677, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2054194', 'n_tokens_mistral': 560, 'n_tokens_neox': 561, 'n_words': 106}