consolidate js functions

Former-commit-id: 3b8d3ff5e3
This commit is contained in:
Scott Richmond 2025-07-04 14:10:27 -04:00
parent 15ed1ee718
commit 5b14e2ab02

19
src/js.rs Normal file
View File

@ -0,0 +1,19 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
pub fn log(a: &str);
#[wasm_bindgen(js_namespace = Math)]
pub fn random() -> f64;
#[wasm_bindgen(js_namespace = Date)]
pub fn now() -> f64;
}
macro_rules! console_log {
($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
}
pub(crate) use console_log;