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://codercto.com/soft/d/22919.html

敏捷项目管理

敏捷项目管理

马克·莱顿 / 人民邮电出版社 / 2015-12-1 / CNY 69.00

当你进行软件开发时,你一定需要一种更快捷、更灵活的方式。《敏捷项目管理》将通过手把手的方式帮你充分发挥你手中的所有可利用工具和技术,以一种非常有效的方式管理好你的项目。通过《敏捷项目管理》,你可以学到:在数周内而不是数月内完成你的软件开发;使用敏捷技术降低项目风险,并提升核心收益;将敏捷理论付诸实践;避免项目管理普遍存在的误区。一起来看看 《敏捷项目管理》 这本书的介绍吧!

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

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具