pub fn emit_event_from_state(state: &AppState, event: &str, payload: &Value)
Emit an event to the “main” browser stored in AppState. This is a convenience wrapper for use from command handlers and background tasks.