From d058244594ce4e37ed13884bc727a5615f1530e8 Mon Sep 17 00:00:00 2001 From: Kevin Delisle Date: Tue, 23 May 2017 12:12:11 -0400 Subject: [PATCH] hooks: add JSDoc for .trigger --- lib/hooks.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/hooks.js b/lib/hooks.js index f3c45550..db946844 100644 --- a/lib/hooks.js +++ b/lib/hooks.js @@ -36,7 +36,17 @@ Hookable.afterUpdate = null; Hookable.beforeDestroy = null; Hookable.afterDestroy = null; -// TODO: Evaluate https://github.com/bnoguchi/hooks-js/ +/** + * @deprecated + * Setup a Model-based hook to trigger when the specified action occurs. + * The trigger is broken up into three segments: `beforeHook`, `work` and + * `afterHook`. + * @param {string} actionName The name of the action that triggers the hook. + * @param {Function} work The 2nd phase of the trigger. + * @param {*} data The value(s) to provide to the 1st phase (`beforeHook`) call. + * @callback + * @param {Function} callback + */ Hookable.prototype.trigger = function trigger(actionName, work, data, callback) { var capitalizedName = capitalize(actionName); var beforeHook = this.constructor['before' + capitalizedName] ||