diff --git a/Cargo.toml b/Cargo.toml index 7d1154a..5e8ecac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] -seed = "^0.2.10" +seed = "^0.3.0" wasm-bindgen = "^0.2.37" web-sys = "^0.3.6" diff --git a/build.ps1 b/build.ps1 index a0aa590..3a88676 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,2 +1,2 @@ -cargo build --target wasm32-unknown-unknown -wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package \ No newline at end of file +cargo build --target wasm32-unknown-unknown --release +wasm-bindgen target/wasm32-unknown-unknown/release/appname.wasm --no-modules --out-dir ./pkg --out-name package \ No newline at end of file diff --git a/build.sh b/build.sh index 409b955..9476444 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,6 @@ #!/usr/bin/env bash cargo build --target wasm32-unknown-unknown -wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package \ No newline at end of file +wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package + +#cargo build --target wasm32-unknown-unknown --release +#wasm-bindgen target/wasm32-unknown-unknown/release/appname.wasm --no-modules --out-dir ./pkg --out-name package \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index d96df49..0124c9b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,16 +25,17 @@ enum Msg { Increment, } -fn update(msg: Msg, model: Model) -> Update { +fn update(msg: Msg, model: &mut Model) -> Update { match msg { - Msg::Increment => Render(Model {val: model.val + 1}) + Msg::Increment => model.val += 1, } + Render.into() } // View -fn view(_state: seed::App, model: &Model) -> El { +fn view(model: &Model) -> El { button![ simple_ev(Ev::Click, Msg::Increment), format!("Hello, World × {}", model.val)