Make async return the last value of a sequence
This commit is contained in:
parent
e7efd4b524
commit
938c4d9aaa
1 changed files with 2 additions and 2 deletions
|
@ -50,11 +50,11 @@ function Async() {
|
||||||
var steps = arguments;
|
var steps = arguments;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
return function(f) {
|
return function(f) {
|
||||||
var step = function() {
|
var step = function(x) {
|
||||||
if(i < steps.length) {
|
if(i < steps.length) {
|
||||||
steps[i++](step);
|
steps[i++](step);
|
||||||
} else {
|
} else {
|
||||||
f();
|
f(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step();
|
step();
|
||||||
|
|
Loading…
Reference in a new issue