Fix inheritance

This commit is contained in:
Anatoliy Chakkaev 2012-10-22 17:33:57 +04:00
parent e6be50eb81
commit c27a624d02
3 changed files with 11 additions and 7 deletions

View File

@ -106,9 +106,6 @@ AbstractClass.prototype._initProperties = function (data, applySetters) {
this.trigger("initialize"); this.trigger("initialize");
} }
AbstractClass.setter = {};
AbstractClass.getter = {};
/** /**
* @param {String} prop - property name * @param {String} prop - property name
* @param {Object} params - various property configuration * @param {Object} params - various property configuration

View File

@ -158,9 +158,16 @@ Schema.prototype.define = function defineClass(className, properties, settings)
hiddenProperty(NewClass, 'cache', {}); hiddenProperty(NewClass, 'cache', {});
hiddenProperty(NewClass, 'mru', []); hiddenProperty(NewClass, 'mru', []);
// setup inheritance // inherit AbstractClass methods
NewClass.__proto__ = AbstractClass; for (var i in AbstractClass) {
util.inherits(NewClass, AbstractClass); NewClass[i] = AbstractClass[i];
}
for (var j in AbstractClass.prototype) {
NewClass.prototype[j] = AbstractClass.prototype[j];
}
NewClass.getter = {};
NewClass.setter = {};
// store class in model pool // store class in model pool
this.models[className] = NewClass; this.models[className] = NewClass;

View File

@ -1,7 +1,7 @@
{ {
"name": "jugglingdb", "name": "jugglingdb",
"description": "ORM for every database: redis, mysql, neo4j, mongodb, postgres, sqlite", "description": "ORM for every database: redis, mysql, neo4j, mongodb, postgres, sqlite",
"version": "0.1.24-pre", "version": "0.1.24-pre2",
"author": "Anatoliy Chakkaev <rpm1602@gmail.com>", "author": "Anatoliy Chakkaev <rpm1602@gmail.com>",
"contributors": [ "contributors": [
{ "name": "Anatoliy Chakkaev", "email": "rpm1602@gmail.com" }, { "name": "Anatoliy Chakkaev", "email": "rpm1602@gmail.com" },