Minimal event emitter implementation that supports both sync and async event handlers