var slice = [].slice

function Vestibule () {
    this._waiting = []
    this.open = null
}

Vestibule.prototype.enter = function (callback) {
    if (this.open == null) {
        var cookie = {}
        this._waiting.push({
            cookie: cookie,
            callback: callback
        })
        return cookie
    }
    callback.apply(null, this.open)
    return null
}

Vestibule.prototype.leave = function (cookie) {
    for (var i = 0, I = this._waiting.length; i < I; i++) {
        if (this._waiting[i].cookie === cookie) {
            this._waiting.splice(i, 1)
            break
        }
    }
}

Vestibule.prototype.notify = function () {
    var vargs = slice.call(arguments)
    this._waiting.splice(0, this._waiting.length).forEach(function (waiting) {
        waiting.callback.apply(null, vargs)
    })
}

module.exports = Vestibule

@@ -62,16 +62,37 @@
 ng = %5B%5D%0A
+    this.waiting = 0%0A
     this
@@ -210,16 +210,39 @@
 ie = %7B%7D%0A
+        this.waiting++%0A
         
@@ -612,16 +612,43 @@
 e(i, 1)%0A
+            this.waiting--%0A
         
@@ -757,16 +757,37 @@
 uments)%0A
+    this.waiting = 0%0A
     this

Add waiting.