Suppose you need to do some operations that depend on some temp file. Since we\'re talking about Node here, those operations are obviously asynchronous. What is the idiomati
// simple countdown latch function CDL(countdown, completion) { this.signal = function() { if(--countdown < 1) completion(); }; } // usage var latch = new CDL(10, function() { console.log("latch.signal() was called 10 times."); });