From 664cddac42571af1ee3fcbc755e17a6b9d6ddc90 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 5 Mar 2017 15:23:13 -0800 Subject: [PATCH] asyncobject: fire hooks before events. --- lib/utils/asyncobject.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utils/asyncobject.js b/lib/utils/asyncobject.js index e8c1b0d7..766f0632 100644 --- a/lib/utils/asyncobject.js +++ b/lib/utils/asyncobject.js @@ -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).