diff --git a/this_algorithm-wasm/Cargo.toml b/this_algorithm-wasm/Cargo.toml new file mode 100644 index 0000000..a0624a0 --- /dev/null +++ b/this_algorithm-wasm/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "this_algorithm-wasm" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2" +# this_algorithm = {path=".."} diff --git a/this_algorithm-wasm/src/lib.rs b/this_algorithm-wasm/src/lib.rs new file mode 100644 index 0000000..d49cf4d --- /dev/null +++ b/this_algorithm-wasm/src/lib.rs @@ -0,0 +1,11 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + pub fn alert(s: &str); +} + +#[wasm_bindgen] +pub fn greet(name: &str) { + alert(&format!("Hello, {}!", name)); +}