asyncobject: fire hooks before events.

This commit is contained in:
Christopher Jeffrey 2017-03-05 15:23:13 -08:00
parent 3c4bee11f2
commit 664cddac42
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -176,10 +176,10 @@ AsyncObject.prototype.hook = function hook(type, handler) {
* @returns {Promise}
*/
AsyncObject.prototype.fire = function fire() {
AsyncObject.prototype.fire = co(function* fire() {
yield this.fireHook.apply(this, arguments);
this.emit.apply(this, arguments);
return this.fireHook.apply(this, arguments);
};
});
/**
* Emit an asynchronous event (hook).