Unfinished and not tested beyond my own case.
Usage
var wait = new Wait();
wait.complete(function () {
console.log('we are done - now report');
});
$.get(url, wait.until(function (data) {
// do something with data
});
db.users.find(wait.until(function (err, docs) {
// we've found users in the mongo db
}));
Unlike jQuery's Deferred, when.js is compliant with the defacto standard (CommonJS Promises/A), runs in browsers and node (and probably RingoJS), and even converts non-compliant promises like $.Deferred to compliant ones. #WIN