DOM access for web assembly * no magic * no abstractions * no code generation * api generated from webidl * technology agnostic
toml
web-dom = "0.0.9"
Documentation: https://docs.rs/web-dom/
Want to create web components? Check out https://github.com/web-dom/webcomponent
```rust use web_dom::*;
pub fn main() -> () {
console::log("hello world")
}
html
toml
[package]
name = "helloworld"
version = "0.0.1"
edition = "2018"
[lib] crate-type =["cdylib"]
[dependencies]
web-dom = "0.0.7"
console
cargo build --target wasm32-unknown-unknown --release
```
See it working here
```rust use web_dom::*;
pub fn main() -> () { window::alert(window(),"hello world!"); } ```
See it working here
```rust use web_dom::*;
pub fn main() -> () { let doc = window::getdocument(window()); let canvas = document::queryselector(doc,"#screen"); let ctx = htmlcanvas::getcontext(canvas,"2d"); drawing::fillrect(ctx,0.0,0.0,50.0,50.0); } ```
See it working here
```rust use web_dom::*;
pub fn callback(listener:EventListener,event:Event) -> () { let input = document::queryselector(document(),"input"); let msg = htmlinput::getvalue(input); window::alert(window(),&msg); }
pub fn main() -> () { let btn = document::queryselector(document(),"button"); let listener = createeventlistener(); eventtarget::addevent_listener(btn,"click",listener); } ```
See it working here
https://github.com/richardanaya/pong/
See it working here