3 Dead-simple optimistic async helper.
8 var Pend = require('pend');
10 pend.max = 10; // defaults to Infinity
11 setTimeout(pend.hold(), 1000); // pend.wait will have to wait for this hold to finish
12 pend.go(function(cb) {
13 console.log("this function is immediately executed");
14 setTimeout(function() {
15 console.log("calling cb 1");
19 pend.go(function(cb) {
20 console.log("this function is also immediately executed");
21 setTimeout(function() {
22 console.log("calling cb 2");
26 pend.wait(function(err) {
27 console.log("this is excuted when the first 2 have returned.");
28 console.log("err is a possible error in the standard callback style.");
35 this function is immediately executed
36 this function is also immediately executed
39 this is excuted when the first 2 have returned.
40 err is a possible error in the standard callback style.