echo_d/lib.rs
1extern crate cfg_if;
2extern crate wasm_bindgen;
3
4// mod utils;
5
6use cfg_if::cfg_if;
7use wasm_bindgen::prelude::*;
8
9cfg_if! {
10 // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
11 // allocator.
12 if #[cfg(feature = "wee_alloc")] {
13 extern crate wee_alloc;
14 #[global_allocator]
15 static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
16 }
17}
18
19#[wasm_bindgen]
20extern {
21 fn alert(s: &str);
22}
23
24#[wasm_bindgen]
25pub fn greet() {
26 alert("Hello, wasm-game-of-life!");
27}