Crates.io | silkenweb-html |
lib.rs | silkenweb-html |
version | 0.1.2 |
source | src |
created_at | 2021-04-29 10:55:19.502357 |
updated_at | 2023-01-07 00:35:54.212703 |
description | Silkenweb HTML types |
homepage | https://github.com/silkenweb/silkenweb |
repository | https://github.com/silkenweb/silkenweb |
max_upload_size | |
id | 390985 |
size | 169,984 |
This is an old implementation crate for Silkenweb that is no longer used.
A library for building reactive single page web apps.
input().dom_element()
returns a web_sys::HtmlInputElement
button().on_click(...)
passes your event handler a web_sys::HtmlInputElement
and a web_sys::MouseEvent
.use silkenweb::{
elements::{button, div, p},
mount,
signal::Signal,
};
fn main() {
let count = Signal::new(0);
let set_count = count.write();
let inc = move |_, _| set_count.replace(|&i| i + 1);
let count_text = count.read().map(|i| format!("{}", i));
let app = div()
.child(button().on_click(inc).text("+"))
.child(p().text(count_text));
mount("app", app);
}
rustup target add wasm32-unknown-unknown
cargo install trunk wasm-pack
cargo install wasm-bindgen-cli --version 0.2.73
cd examples/counter
trunk serve --open