notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

notedeck.rs (1263B)


      1 #![warn(clippy::all, rust_2018_idioms)]
      2 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
      3 use notedeck::app_creation::generate_native_options;
      4 use notedeck::Damus;
      5 
      6 // Entry point for wasm
      7 //#[cfg(target_arch = "wasm32")]
      8 //use wasm_bindgen::prelude::*;
      9 
     10 // Desktop
     11 #[cfg(not(target_arch = "wasm32"))]
     12 #[tokio::main]
     13 async fn main() {
     14     // Log to stdout (if you run with `RUST_LOG=debug`).
     15     tracing_subscriber::fmt::init();
     16 
     17     let _res = eframe::run_native(
     18         "Damus NoteDeck",
     19         generate_native_options(),
     20         Box::new(|cc| Ok(Box::new(Damus::new(cc, ".", std::env::args().collect())))),
     21     );
     22 }
     23 
     24 #[cfg(target_arch = "wasm32")]
     25 pub fn main() {
     26     // Make sure panics are logged using `console.error`.
     27     console_error_panic_hook::set_once();
     28 
     29     // Redirect tracing to console.log and friends:
     30     tracing_wasm::set_as_global_default();
     31 
     32     wasm_bindgen_futures::spawn_local(async {
     33         let web_options = eframe::WebOptions::default();
     34         eframe::start_web(
     35             "the_canvas_id", // hardcode it
     36             web_options,
     37             Box::new(|cc| Box::new(Damus::new(cc, "."))),
     38         )
     39         .await
     40         .expect("failed to start eframe");
     41     });
     42 }