hooks: add JSDoc for .trigger

This commit is contained in:
Kevin Delisle 2017-05-23 12:12:11 -04:00
parent a007c5a3fa
commit d058244594
1 changed files with 11 additions and 1 deletions

View File

@ -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] ||