X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=xynt-base.js;fp=xynt-base.js;h=80c924985a59ad4c5cd07fcfaeb90337baf04eea;hb=4450618fd580a5491bafcc9d1238dd89e501f9cf;hp=0000000000000000000000000000000000000000;hpb=50efdc4b283f3cb7dadbfc032a87e85f74faa2c7;p=xynt.git diff --git a/xynt-base.js b/xynt-base.js new file mode 100644 index 0000000..80c9249 --- /dev/null +++ b/xynt-base.js @@ -0,0 +1,49 @@ +function Extends(sub) +{ + var proto; + thinF = function(){}; + inh = new thinF(); + inh.xynt_sup = []; + inh.xynt_sup_cl = []; + + console.log("INIZIO EXT"); + + var multi = function(sub, super, is_last) + { + var proto = super.prototype; + + for (var f in proto) { + if (f == "xynt_sup" || f == "xynt_sup_cl") + continue; + + console.log("LOOP: "+f); + if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){ + console.log("M_FU: "+proto['name']+" F: "+f); + // sub[f] = proto[f]; + sub[f] = function(){ + console.log("INFU PR: " + proto['name'] + " FUNC: "+f+" THIS: " + this); + return proto[f].apply(this,arguments); + } + } + else { + console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]); + sub[f] = proto[f]; + } + } + } + + for( var i=1; i < arguments.length ; i++){ + multi(inh, arguments[i], false); + inh.xynt_sup.push(arguments[i].prototype); + inh.xynt_sup_cl.push(arguments[i]); + } + + multi(inh, sub, true); + inh.super = function(cl, method) { + return this.xynt_sup_cl[cl].method.apply(this,arguments); + } + sub.prototype = inh; + + console.log(sub.prototype.xynt_sup); + console.log(sub.prototype.xynt_sup_cl); +}