Allow chained superclassing

When calling `gun.chain()`, gun invokes the constructor. If you create a
new class that inherits from gun, it will only work as far as there
aren't any `.chain` calls. This changes it from invoking the gun
constructor to instead invoke your current class context.
This commit is contained in:
Jesse Gibson 2016-04-05 18:25:30 -06:00
parent bc688a4e7f
commit e614e2f5aa

2
gun.js
View File

@ -550,7 +550,7 @@
}
Gun.chain.chain = function(s){
var from = this, gun = !from.back? from : Gun(from);
var from = this, gun = !from.back? from : new this.constructor(from);
gun.back = gun.back || from;
gun.__ = gun.__ || from.__;
gun._ = gun._ || {};