mod.rs 799 Bytes
mod logic;
mod state;
mod view;

use mogwai::prelude::*;

use self::{logic::markdown_logic, view::markdown_view};

pub(crate) async fn new() -> Component<Dom> {
    let (tx_dom, rx_dom) = broadcast::bounded(1);
    let (tx_logic, rx_logic) = broadcast::bounded(1);
    let (tx_toggle, rx_toggle) = broadcast::bounded(1);
    let (tx_patches, rx_patches) = mpmc::bounded(1);

    let view = markdown_view( tx_logic.clone()
                            , rx_toggle
                            , rx_patches
                            , tx_dom );
    let logic = markdown_logic( rx_logic
                              , tx_logic
                              , tx_toggle
                              , tx_patches
                              , rx_dom );

    Component::from(view).with_logic(logic)
}