Add this_algorithm-wasm
This commit is contained in:
parent
213f7fd3e7
commit
c20d2f3085
13
this_algorithm-wasm/Cargo.toml
Normal file
13
this_algorithm-wasm/Cargo.toml
Normal file
@ -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=".."}
|
11
this_algorithm-wasm/src/lib.rs
Normal file
11
this_algorithm-wasm/src/lib.rs
Normal file
@ -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));
|
||||
}
|
Loading…
Reference in New Issue
Block a user