lib.rs 846 Bytes
mod api;
mod data;
mod error;
mod client;
mod component;

use cfg_if::cfg_if;
cfg_if! {
    if #[cfg(feature = "wee_alloc")] {
        #[global_allocator]
        static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
    }
}

#[cfg(feature = "console_error_panic_hook")]
use std::panic;

use crate::component::*;
use log::Level;
use mogwai::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub async fn main() -> Result<(), JsValue> {
    #[cfg(feature = "console_error_panic_hook")]
    panic::set_hook(Box::new(console_error_panic_hook::hook));

    console_log::init_with_level(Level::Trace).unwrap();

    let md = markdown::new().await;
    let comp = upload::new().await;

    let page = Component::from(builder! {
        <div>
            {comp}
            {md}
        </div>
    });
    page.build()?.run()
}