Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

asynquence: sequences & gates at a glance. https://github.com/getify/asynquence

View only-gate.js
1 2 3 4 5 6 7 8 9 10
ASQ()
.all( // or .gate(..)
// these 3 run "in parallel"
function(done){ setTimeout(done,100); },
function(done){ setTimeout(done,200); },
function(done){ setTimeout(done,300); }
)
.then(function(){
alert("All tasks are complete, and that only took ~300ms, not 600ms!");
});
View only-gate.js
1 2 3 4 5 6 7 8
ASQ()
// these 3 run "in succession"
.then(function(done){ setTimeout(done,100); })
.then(function(done){ setTimeout(done,200); })
.then(function(done){ setTimeout(done,300); })
.then(function(){
alert("All tasks are complete, and that took ~600ms!");
});
View only-gate.js
1 2 3 4 5 6 7 8 9 10
ASQ()
.then(function(done){ setTimeout(done,100); })
.all( // or .gate(..)
// these 2 run "in parallel"
function(done){ setTimeout(done,200); },
function(done){ setTimeout(done,300); }
)
.then(function(){
alert("All tasks are complete, and that took ~400ms!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.