Add support for global event handlers

Add the template foo required to define global event handlers.