-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtry06.html
32 lines (32 loc) · 928 Bytes
/
try06.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>I promised I will try Q</title>
<script src="./lib/q/q-20130830/q.js"></script>
<script>
var step1 = function () {
console.log("This is step 1");
return "ret 1";
};
var stepA = function () {
console.log("This is step A, args=", arguments);
return "ret A";
};
var stepB = function () {
console.log("This is step B, args=", arguments);
return "ret B";
};
var finalStep = function (retA, retB) {
console.log("This is the final step, args=", arguments);
};
var promise1 = Q.fcall(step1);
var promiseA = promise1.then(stepA);
var promiseB = promise1.then(stepB);
var promiseAB = Q.all([promiseA, promiseB]);
promiseAB.spread(finalStep);
</script>
</head>
<body>
Check console.
</body>
</html>