IrisJS

< Issues Create new issue

Get previous hook in chain's filename #395

open
FilipNest 2017-03-27T22:07:29Z - 0 comments
FilipNest commented 2017-03-27T22:07:29Z

Allow a hook function to get the filename of the hook function that came before it. Aiming to possibly decouple hooks and modules in the future because of new opportunities opened up by #394 . This will make working with that easier as you'll be able to debug where a hook came from.

Regardless, this is probably a useful debugging function even now.

iris.modules.myModule.registerHook("hook_form_render__login", 3, function(thisHook,data){

    console.log(thisHook.previousHook);

    thisHook.pass(data);

});