20 lines
387 B
Rust
20 lines
387 B
Rust
|
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;
|