摘要:
backbone.js珍藏版,方便一次阅读! 阅读全文
摘要:
直接贴代码:
/**
* 迷你版的deferred
*/
function Deferred(func) {
if (this instanceof Deferred === false) {
return new Deferred(func)
}
var tuple = [];
var promise = {
resolve: function () {
var t;
while (t = tuple.shift()) {
t.apply(null, arguments);
}
},
then: function (n) {
return tuple.push(n), this;
}
} 阅读全文