add a closure to inline event callbacks