jQuery Deferred
- 授权协议: 未知
- 开发语言:
- 操作系统: 未知
- 软件首页: http://plugins.jquery.com/project/deferred
软件介绍
Simple and clean asynchronous/nonblocking processing system JSDeferred (is like MochiKit and with some extension) with jQuery supports.
jQuery supports: overwrite ajax functions get, post and getJSON to return Deferred object (no arguments change).
Collect some asynchronous resources by ajax.
parallel([
$.get("a.html").next(function (data) {
return data.match(/([^<]+)<\/title>/);
}),
$.get("b.txt" ).next(function (data) {
return data.match(/##\s*([^<]+)\s*##/);
}),
$.getJSON("c.json").next(function (data) {
return data.title;
})
]).next(function (values) {
print("Titles "+values.join(", "));
});
Divided loop for non stress browsing. When long time processing is required, it is bad that simply using only for loop because it stops browser appearance. Deferred resolves it with bare minimum of effort.
loop({begin: 1, end:100, step:10}, function (n, o) {
print(["Processing divided loop:n=", n].join(""));
for (var i = 0; i < o.step; i++) {
var j = n + i;
print(j);
}
});
Like tail call code. If you are habituated to functional programming, this syntax may be familiar to you.
next(function () {
function pow (x, n) {
function _pow (n, r) {
if (n == 0) return r;
return call(_pow, n - 1, x * r);
}
return call(_pow, n, 1);
}
return call(pow, 2, 10);
}).
next(function (r) {
log([r, "end"]);
});
程序员代码面试指南:IT名企算法与数据结构题目最优解
左程云 / 电子工业出版社 / 2015-9 / 79.00元
这是一本程序员面试宝典!书中对IT名企代码面试各类题目的最优解进行了总结,并提供了相关代码实现。针对当前程序员面试缺乏权威题目汇总这一痛点,本书选取将近200道真实出现过的经典代码面试题,帮助广大程序员的面试准备做到万无一失。“刷”完本书后,你就是“题王”!__eol__本书采用题目+解答的方式组织内容,并把面试题类型相近或者解法相近的题目尽量放在一起,读者在学习本书时很容易看出面试题解法之间的联......一起来看看 《程序员代码面试指南:IT名企算法与数据结构题目最优解》 这本书的介绍吧!
