Add support for hooked function callback arguments #8

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

Passes callback arguments from the hooked function back to the original callback function. It also allows post functions to modify the callback arguments.

Example:

var A = function () {};
_.extend(A, hooks);
A.hook('get', function (key, callback) {      
  callback(null, 123);
});
A.post('get', function(next, key, callback, err, val) {
  assert.equal(val, 123);
  next(key, callback, err, 456);
});
var a = new A();
a.get(2, function(err, val){
  assert.equal(val, 456);
});

contra commented Mar 25, 2013

+1 I also need this to work properly

JamesHight closed this Feb 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment