diff --git a/Cargo.toml b/Cargo.toml index 2d062c3..b6c28c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] -seed = "^0.2.3" +seed = "^0.2.4" wasm-bindgen = "^0.2.33" web-sys = "^0.3.6" diff --git a/index.html b/index.html index 8cb6f2f..0291a3c 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ -
+
diff --git a/src/lib.rs b/src/lib.rs index 4adf64d..e2f2d43 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,16 +26,16 @@ enum Msg { Increment, } -fn update(msg: Msg, model: Model) -> Model { +fn update(msg: Msg, model: Model) -> Update { match msg { - Msg::Increment => Model {val: model.val + 1} + Msg::Increment => Render(Model {val: model.val + 1}) } } // View -fn view(_state: seed::App, model: Model) -> El { +fn view(_state: seed::App, model: &Model) -> El { button![ simple_ev("click", Msg::Increment), format!("Hello, World × {}", model.val) @@ -44,5 +44,8 @@ fn view(_state: seed::App, model: Model) -> El { #[wasm_bindgen] pub fn render() { - seed::run(Model::default(), update, view, "main", None, None); + seed::App::build(Model::default(), update, view) + .finish() + .run(); + } \ No newline at end of file