CityWebConsultants / Iris

Modular content management and web application framework built with Node.js and MongoDB
http://irisjs.org
Other
9 stars 7 forks source link

Get previous hook in chain's filename #395

Open FilipNest opened 7 years ago

FilipNest commented 7 years ago

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);

});