atproto blogging
1//! Entry point for the editor web worker.
2//!
3//! This binary is compiled separately and loaded by the main app
4//! to handle CPU-intensive editor operations off the main thread.
5
6#[cfg(all(target_family = "wasm", target_os = "unknown"))]
7fn main() {
8 console_error_panic_hook::set_once();
9 use tracing::Level;
10 use tracing::subscriber::set_global_default;
11 use tracing_subscriber::Registry;
12 use tracing_subscriber::filter::EnvFilter;
13 use tracing_subscriber::layer::SubscriberExt;
14
15 let console_level = if cfg!(debug_assertions) {
16 Level::DEBUG
17 } else {
18 Level::DEBUG
19 };
20
21 let wasm_layer = tracing_wasm::WASMLayer::new(
22 tracing_wasm::WASMLayerConfigBuilder::new()
23 .set_max_level(console_level)
24 .build(),
25 );
26
27 // Filter out noisy crates
28 let filter = EnvFilter::new(
29 "debug,loro_internal=warn,jacquard_identity=info,jacquard_common=info,iroh=info",
30 );
31
32 let reg = Registry::default().with(filter).with(wasm_layer);
33
34 let _ = set_global_default(reg);
35
36 use gloo_worker::Registrable;
37 use weaver_app::components::editor::EditorReactor;
38
39 EditorReactor::registrar().register();
40}
41
42#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
43fn main() {
44 eprintln!("This binary is only meant to run as a WASM web worker");
45}