Skip to content

@getify /only-gate.js
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
asynquence: sequences & gates at a glance. https://github.com/getify/asynquence
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!");
});
ASQ()
.then(
// these 3 run "in succession"
function(done){ setTimeout(done,100); },
function(done){ setTimeout(done,200); },
function(done){ setTimeout(done,300); }
)
.then(function(){
alert("All tasks are complete, and that took ~600ms!");
});
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.