Comparing version 1.1.5 to 1.1.6
27
index.js
/** | ||
* jclass v1.1.4 | ||
* jclass v1.1.6 | ||
* https://github.com/riga/jclass | ||
@@ -264,3 +264,26 @@ * | ||
BaseClass._convert = function(cls, options) { | ||
return BaseClass._extend(cls.prototype, {}, options); | ||
// the properties consist of the class' prototype | ||
var instanceMembers = cls.prototype; | ||
// add the constructor function | ||
instanceMembers.init = function() { | ||
// simply create an instance of our target class | ||
var origin = this._origin = BaseClass._construct(cls, arguments); | ||
// add properties for each own property in _origin | ||
for (var key in instanceMembers) { | ||
if (!this._origin.hasOwnProperty(key)) { | ||
continue; | ||
} | ||
Object.defineProperty(this, key, { | ||
get: function() { | ||
return origin[key]; | ||
} | ||
}); | ||
} | ||
}; | ||
// finally, create and return our new class | ||
return BaseClass._extend(instanceMembers, {}, options); | ||
}; | ||
@@ -267,0 +290,0 @@ |
{ | ||
"name": "jclass", | ||
"preferGlobal": false, | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"author": "Marcel Rieger <marcelrieger@icloud.com>", | ||
@@ -6,0 +6,0 @@ "description": "Advanced but lightweight and fast Javascript inheritance model providing class members and prototype conversion.", |
@@ -161,2 +161,3 @@ # jclass | ||
The instance of the (original) prototyped class is stored as ``_origin`` in each jclass instance. | ||
@@ -163,0 +164,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19737
432
204