
var Area = module.exports = function Area() {
  // nothing
}

Area.prototype = {
  count: 0
, callback: null

, join: function(callback) {
    if (this.count == 0)
      return callback()
    this.callback = callback
  }

, increase: function() {
    this.count ++
  }

, decrease: function() {
    this.count --
    if( this.count == 0 && this.callback )
      this.callback()
  }
}

Function.prototype.join = function(area) {
  var self = this
  area.increase()
  return function() {
    self.apply(this, Array.prototype.slice.call(arguments))
    area.decrease()
  }
}


@@ -157,17 +157,39 @@
 nt == 0)
+ %7B%0A      this._reset()
 %0A
-
       re
@@ -204,16 +204,22 @@
 lback()%0A
+    %7D%0A
     this
@@ -377,22 +377,33 @@
 llback )
+ %7B
 %0A     
+ var cb =
  this.ca
@@ -408,18 +408,125 @@
 callback
-()
+%0A      this._reset()%0A      cb()%0A    %7D%0A  %7D%0A%0A, _reset: function() %7B%0A    this.count = 0%0A    this.callback = null
 %0A  %7D%0A%7D%0A%0A

reset on join