Browse Source

wasm exercise 1

master
Georg Hopp 6 years ago
parent
commit
37b4ac30e6
Signed by: ghopp GPG Key ID: 4C5D226768784538
  1. 4
      tutorial/wasm-game-of-life/src/lib.rs
  2. 2
      tutorial/wasm-game-of-life/www/index.js

4
tutorial/wasm-game-of-life/src/lib.rs

@ -14,6 +14,6 @@ extern {
} }
#[wasm_bindgen] #[wasm_bindgen]
pub fn greet() {
alert("Hello, {{project-name}}!");
pub fn greet(s :&str) {
alert(&format!("Hello, {}!", s));
} }

2
tutorial/wasm-game-of-life/www/index.js

@ -1,3 +1,3 @@
import * as wasm from "wasm-game-of-life"; import * as wasm from "wasm-game-of-life";
wasm.greet();
wasm.greet("It's all a game");
Loading…
Cancel
Save