jQuery Deferred

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-08 10:43:07

软件介绍

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"]);
});

 

See more samples!

本文地址:https://www.codercto.com/soft/d/22919.html

数据挖掘概念与技术

数据挖掘概念与技术

(加)Jiawei Han;Micheline Kamber / 范明、孟小峰 / 机械工业 / 2007-3 / 55.00元

《数据挖掘概念与技术(原书第2版)》全面地讲述数据挖掘领域的重要知识和技术创新。在第1版内容相当全面的基础上,第2版展示了该领域的最新研究成果,例如挖掘流、时序和序列数据以及挖掘时间空间、多媒体、文本和Web数据。本书可作为数据挖掘和知识发现领域的教师、研究人员和开发人员的一本必读书。 《数据挖掘概念与技术(原书第2版)》第1版曾是受读者欢迎的数据挖掘专著,是一本可读性极佳的教材。第2版充实了数据......一起来看看 《数据挖掘概念与技术》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器