最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

dess中一個(gè)簡(jiǎn)單的多路委托的實(shí)現(xiàn)

 更新時(shí)間:2010年07月20日 01:14:09   作者:  
這個(gè)SDelegate用起來(lái)可能會(huì)比較詭異,比如很多操作都要重新賦值。Dess中,SDelegate主要用于一些特定場(chǎng)合,如DOM事件派發(fā)。
復(fù)制代碼 代碼如下:

var SDelegate = function(f, b, c) {
if (b) {
this.asFunction_ = function() {
return f.apply(b, arguments);
}
} else {
this.asFunction_ = function() {
return f.apply(this, arguments);
}
}
this.method_ = f;
this.binding_ = b;
this.continus = c;
}
SDelegate.composite = function(d) {
if (d.continus) {
var con = d.continus.composited_ = SDelegate.composite(d.continus);
var method = d.asFunction_;
return function() {
con.apply(this, arguments);
return method.apply(this, arguments);
}
} else {
return d.asFunction_;
}
}
SDelegate.prototype.call = function() {
if (!this.composited_) this.composited_ = SDelegate.composite(this);
return this.composited_.apply(arguments[0], Array.prototype.slice.call(arguments, 1));
}
SDelegate.prototype.remove = function() {
var removeP = function(parent, item, test, data) {
if (!item) return;
parent.composited_ = item.composited_ = null;
if (test(item, data)) {
parent.continus = item.continus;
removeP(parent, item.continus, test, data);
} else {
removeP(item, item.continus, test, data);
}
};
return function(test, data) {
var p = this;
if (test(this, data)) {
p = this.continus;
}
removeP(p, p.continus, test, data);
p.composited_ = null;
return p;
}
}();
SDelegate.prototype.append = function(f, b) {
return new SDelegate(f, b, this);
}

這個(gè)SDelegate用起來(lái)可能會(huì)比較詭異,比如很多操作都要重新賦值。Dess中,SDelegate主要用于一些特定場(chǎng)合,如DOM事件派發(fā)。

相關(guān)文章

最新評(píng)論

东山县| 屯门区| 泌阳县| 祁阳县| 渭源县| 搜索| 广宁县| 金阳县| 乌拉特后旗| 诸城市| 随州市| 宝应县| 西青区| 屏山县| 潢川县| 西城区| 临澧县| 鄂伦春自治旗| 郯城县| 偏关县| 双牌县| 岫岩| 万州区| 德安县| 鱼台县| 中超| 海阳市| 龙里县| 龙游县| 儋州市| 馆陶县| 浦江县| 凤凰县| 景洪市| 克东县| 慈利县| 潼南县| 伊宁市| 固镇县| 天长市| 呼玛县|