Stop overwriting the static methods

This commit is contained in:
Raymond Feng 2013-11-11 22:05:50 -08:00
parent ec7f79e935
commit 275bb6ffac
1 changed files with 5 additions and 4 deletions

View File

@ -154,7 +154,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
var events = new EventEmitter();
for (var f in EventEmitter.prototype) {
if (typeof EventEmitter.prototype[f] === 'function') {
ModelClass[f] = events[f].bind(events);
ModelClass[f] = EventEmitter.prototype[f].bind(events);
}
}
util.inherits(ModelClass, ModelBaseClass);
@ -178,9 +178,10 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
// inherit ModelBaseClass static methods
for (var i in ModelBaseClass) {
if(i !== '_mixins') {
ModelClass[i] = ModelBaseClass[i];
}
// We need to skip properties that are already in the subclass, for example, the event emitter methods
if(i !== '_mixins' && !(i in ModelClass)) {
ModelClass[i] = ModelBaseClass[i];
}
}
ModelClass.getter = {};