Allow calling a proc when an action is triggered

Hi, 
a total newbie here, but I wish something like this existed. Not sure if it's the best way to go, so feel free to do it in a different way and ignore this pull request.

Thanks