javascript-hooker icon indicating copy to clipboard operation
javascript-hooker copied to clipboard

Hook a plain function

Open killmenot opened this issue 11 years ago • 0 comments

Hi Ben,

Is it possible to hook a simple function like a callback? See the code above? Maybe you can suggest how to do it?

hooker.hook(client, ['get'], {
  pre: function () {
    var url = arguments[0];
    var cb = arguments[1];

    hooker.hook(cb, {
        once: true,
        pre: function () {
            var response = arguments[2];
            // TODO: Put response to log...
        }
    });
  }
});

killmenot avatar Mar 15 '14 19:03 killmenot