hooks: add JSDoc for .trigger
This commit is contained in:
parent
a007c5a3fa
commit
d058244594
12
lib/hooks.js
12
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] ||
|
||||
|
|
Loading…
Reference in New Issue