Skip to content

Instantly share code, notes, and snippets.

@danwrong danwrong/s.js
Created Mar 17, 2011

Embed
What would you like to do?
function Sequence(deps) {
this.deps = deps;
}
Sequence.prototype = new Dependency;
Sequence.prototype.start = function() {
var me = this, nextDep = 0, allResults = [];
(function next() {
var dep = me.deps[nextDep++];
if (dep) {
dep.then(function(results) {
if (dep.results.length > 0) {
allResults.concat(rep.results);
}
next();
});
} else {
me.complete(allResults);
}
}());
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.