Helper function that centralizes the listener to an event and calls them on demand.