Sha256: d71c740bfe66d29fd6293e9eeb0e93c3225abdb3b81e350afa4d7bc637c7fcc0
Contents?: true
Size: 950 Bytes
Versions: 94
Compression:
Stored size: 950 Bytes
Contents
"use strict"; var Q = require("../q"); suite("Chaining", function () { var numberToChain = 1000; bench("Chaining many already-fulfilled promises together", function (done) { var currentPromise = Q(); for (var i = 0; i < numberToChain; ++i) { currentPromise = currentPromise.then(function () { return Q(); }); } currentPromise.then(done); }); bench("Chaining and then fulfilling the end of the chain", function (done) { var deferred = Q.defer(); var currentPromise = deferred.promise; for (var i = 0; i < numberToChain; ++i) { (function () { var promiseToReturn = currentPromise; currentPromise = Q().then(function () { return promiseToReturn; }); }()); } currentPromise.then(done); deferred.resolve(); }); });
Version data entries
94 entries across 80 versions & 4 rubygems