Skip to content

Commit

Permalink
prevent leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
eldargab committed Sep 4, 2012
1 parent 4a8041e commit 9622f35
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/box.js
Expand Up @@ -50,11 +50,11 @@ Box.prototype.execute = function (app) {
this.isSync
? this.done(this.fn.call(proxy, get))
: this.fn.call(proxy, get, function (error, val) {
if (error) return app._raise(self.path, error)
if (error) return self.error(app, error)
self.done(val)
})
} catch (e) {
app._raise(this.path, e)
this.error(app, e)
}
}

Expand All @@ -68,6 +68,11 @@ Box.prototype.done = function (val) {
this.callbacks = null
}

Box.prototype.error = function (app, err) {
this.callbacks = null
app._raise(this.path, err)
}

Box.prototype.onready = function (cb) {
this.callbacks = this.callbacks || []
this.callbacks.push(cb)
Expand Down

0 comments on commit 9622f35

Please sign in to comment.