pub fn emit_event<T: Serialize>(event: &str, payload: &T)
Emit an event to the UI layer. No-op if no emitter is registered.