Updated for v0.2.4 release

master
DavidOConnor 6 years ago
parent 8705283bb0
commit a35bcaea8d

@ -10,7 +10,7 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
seed = "^0.2.3" seed = "^0.2.4"
wasm-bindgen = "^0.2.33" wasm-bindgen = "^0.2.33"
web-sys = "^0.3.6" web-sys = "^0.3.6"

@ -14,7 +14,7 @@
</head> </head>
<body> <body>
<section id="main"></section> <section id="app"></section>
<script src='./pkg/package.js'></script> <script src='./pkg/package.js'></script>

@ -26,16 +26,16 @@ enum Msg {
Increment, Increment,
} }
fn update(msg: Msg, model: Model) -> Model { fn update(msg: Msg, model: Model) -> Update<Model> {
match msg { match msg {
Msg::Increment => Model {val: model.val + 1} Msg::Increment => Render(Model {val: model.val + 1})
} }
} }
// View // View
fn view(_state: seed::App<Msg, Model>, model: Model) -> El<Msg> { fn view(_state: seed::App<Msg, Model>, model: &Model) -> El<Msg> {
button![ button![
simple_ev("click", Msg::Increment), simple_ev("click", Msg::Increment),
format!("Hello, World × {}", model.val) format!("Hello, World × {}", model.val)
@ -44,5 +44,8 @@ fn view(_state: seed::App<Msg, Model>, model: Model) -> El<Msg> {
#[wasm_bindgen] #[wasm_bindgen]
pub fn render() { pub fn render() {
seed::run(Model::default(), update, view, "main", None, None); seed::App::build(Model::default(), update, view)
.finish()
.run();
} }
Loading…
Cancel
Save