promise

来源:互联网 发布:淘宝商家怎么找客服 编辑:程序博客网 时间:2024/06/06 00:25
网上找到一段promise
    var Promise = function () {        this.thens = [];    };    Promise.prototype = {        resolve: function () {            var t = this.thens.shift(), n;            t && (n = t.apply(null, arguments), n instanceof Promise && (n.thens = this.thens));        },        then: function (n) {            return this.thens.push(n), this;        }    }
// 修改后

promise

原创粉丝点击