33 lines
576 B
Rust
Raw Normal View History

2020-10-10 22:41:31 +01:00
mod utils;
use wasm_bindgen::prelude::*;
extern crate web_sys;
macro_rules! log {
( $( $t:tt )* ) => {
web_sys::console::log_1(&format!( $( $t )* ).into());
}
}
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
alert("Hello, Wazem!");
}
#[wasm_bindgen]
pub fn test_log() {
log!("Hello browser, Love Wazem!");
}