snappymail/vendors/Q/examples/all.js
RainLoop Team c23ba31e17 Promises (first look)
Thread dropdown
Small fixes
2015-03-14 18:27:44 +04:00

22 lines
306 B
JavaScript

"use strict";
var Q = require("../q");
function eventually(value) {
return Q.delay(value, 1000);
}
Q.all([1, 2, 3].map(eventually))
.done(function (result) {
console.log(result);
});
Q.all([
eventually(10),
eventually(20)
])
.spread(function (x, y) {
console.log(x, y);
})
.done();