This commit is contained in:
2026-07-27 17:22:50 +07:00
parent 8d4d8184e6
commit fd32b8c0ce
3 changed files with 28 additions and 3 deletions

View File

@@ -4,9 +4,6 @@ version.workspace = true
edition.workspace = true
publish.workspace = true
[lib]
crate-type = ["cdylib"]
[dependencies]
workspace = { path = "../crates/workspace" }
assets = { path = "../crates/assets" }
@@ -29,6 +26,8 @@ console_error_panic_hook = "0.1"
tracing-wasm = "0.2"
console_log = "1.0"
wasm-bindgen = "0.2"
universal-time = "0.3.0"
web-time = "1.1.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom_0_2 = { package = "getrandom", version = "0.2", features = ["js"] }

View File

@@ -1,7 +1,31 @@
use std::time::Duration;
use gpui::*;
use ui::Root;
use universal_time::{Instant, MonotonicClock, SystemTime, WallClock, define_time_provider};
use wasm_bindgen::prelude::*;
struct CustomTimeProvider;
impl WallClock for CustomTimeProvider {
fn system_time(&self) -> SystemTime {
SystemTime::from_unix_duration(Duration::from_secs(0))
}
}
impl MonotonicClock for CustomTimeProvider {
fn instant(&self) -> Instant {
Instant::from_ticks(Duration::from_secs(0))
}
}
define_time_provider!(CustomTimeProvider);
fn main() {
// Binary entry point — actual initialization happens in `run()` below,
// which is called explicitly from JavaScript after the WASM module loads.
}
#[wasm_bindgen]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();