use lazy_static::lazy_static;
use tokio::sync::broadcast;

#[derive(Debug, Clone)]
pub enum UiCmd {
    Repaint,
}

lazy_static! {
    static ref UiBroadcast: broadcast::Sender<UiCmd> = {
        let (tx, _) = broadcast::channel(10);
        tx
    };
}

pub fn get_ui_broadcast_sender() -> broadcast::Sender<UiCmd> {
    UiBroadcast.clone()
}

pub fn get_ui_broadcast_receiver() -> broadcast::Receiver<UiCmd> {
    UiBroadcast.subscribe()
}
