<commit_before>exports.notify = {
  notify: function(eventName) {
    this.dispatchEvent(eventName, this[eventName]);
  }
};

exports.autoProperty = {
  createAutoProperty: function(propertyName, defaultValue, readonly) {
    if (!readonly) {
      Object.defineProperty(this, propertyName, {
        get: function() {
          if (!this["_" + propertyName])
            this["_" + propertyName] = defaultValue;
          return this["_" + propertyName];
        },
        set: function(val) {
          if (val != this["_" + propertyName]) {
            this["_" + propertyName] = val;
            if (this.notify)
              this.notify(propertyName, val);
          }
        },
        configurable: false,
        enumerable: true
      });
    } else {
      Object.defineProperty(this, "_" + propertyName, {
        get: function() {
          if (!this["__" + propertyName])
            this["__" + propertyName] = defaultValue;
          return this["__" + propertyName];
        },
        set: function(val) {
          if (val != this["__" + propertyName]) {
            this["__" + propertyName] = val;
            if (this.notify)
              this.notify(propertyName, val);
          }
        },
        configurable: false,
        enumerable: false
      });
      Object.defineProperty(this, propertyName, {
        get: function() {
          return this["__" + propertyName];
        },
        configurable: false,
        enumerable: true
      });
    }
  }
};

exports.managedEvents = {
  addManagedEventListener: function(subject, property, handler) {
    if (subject && property && handler) {
      var binding = handler.bind(this);
      this._managedEvents = this._managedEvents || [];
      this._managedEvents.push({
        subject: subject,
        property: property,
        handler: handler,
        binding: binding
      });
      subject.addEventListener(property, binding);
    }
  },

  removeAllManagedEventListeners : function() {
    if (this._managedEvents) {
      this._managedEvents.forEach(function(ctx) {
        if (ctx.subject && ctx.property && ctx.binding)
          ctx.subject.removeEventListener(ctx.property, ctx.binding);
      });
      this._managedEvents = null;
    }
  }
};<commit_msg>BugFix for null reference for some frameworks on core view dipose<commit_after>exports.notify = {
  notify: function(eventName) {
    this.dispatchEvent(eventName, this[eventName]);
  }
};

exports.autoProperty = {
  createAutoProperty: function(propertyName, defaultValue, readonly) {
    if (!readonly) {
      Object.defineProperty(this, propertyName, {
        get: function() {
          if (!this["_" + propertyName])
            this["_" + propertyName] = defaultValue;
          return this["_" + propertyName];
        },
        set: function(val) {
          if (val != this["_" + propertyName]) {
            this["_" + propertyName] = val;
            if (this.notify)
              this.notify(propertyName, val);
          }
        },
        configurable: false,
        enumerable: true
      });
    } else {
      Object.defineProperty(this, "_" + propertyName, {
        get: function() {
          if (!this["__" + propertyName])
            this["__" + propertyName] = defaultValue;
          return this["__" + propertyName];
        },
        set: function(val) {
          if (val != this["__" + propertyName]) {
            this["__" + propertyName] = val;
            if (this.notify)
              this.notify(propertyName, val);
          }
        },
        configurable: false,
        enumerable: false
      });
      Object.defineProperty(this, propertyName, {
        get: function() {
          return this["__" + propertyName];
        },
        configurable: false,
        enumerable: true
      });
    }
  }
};

exports.managedEvents = {
  addManagedEventListener: function(subject, property, handler) {
    if (subject && property && handler) {
      var binding = handler.bind(this);
      this._managedEvents = this._managedEvents || [];
      this._managedEvents.push({
        subject: subject,
        property: property,
        handler: handler,
        binding: binding
      });
      subject.addEventListener(property, binding);
    }
  },

  removeAllManagedEventListeners : function() {
    if (this._managedEvents) {
      this._managedEvents.forEach(function(ctx) {
        if (ctx.subject && ctx.property && ctx.binding && ctx.subject.removeEventListener)
          ctx.subject.removeEventListener(ctx.property, ctx.binding);
      });
      this._managedEvents = null;
    }
  }
};
{'fraction_non_alphanumeric': 0.13002826701456838, 'fraction_numerical': 0.0, 'mean_word_length': 2.122878479293958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '618559', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1239, 'n_words': 255}