chore: prepare for web target

This commit is contained in:
Ren Amamiya
2026-03-31 08:45:35 +07:00
parent c8034642c5
commit b0ba2549d7
6 changed files with 277 additions and 70 deletions

View File

@@ -0,0 +1,26 @@
use gpui::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();
// Initialize logging to browser console
console_log::init_with_level(log::Level::Info).expect("Failed to initialize logger");
// Also initialize tracing for WASM
tracing_wasm::set_as_global_default();
#[cfg(target_family = "wasm")]
gpui_platform::web_init();
#[cfg(not(target_family = "wasm"))]
let app = gpui_platform::application();
#[cfg(target_family = "wasm")]
let app = gpui_platform::single_threaded_web();
app.run(|_cx| {});
Ok(())
}