diff options
author | natrixaeria <janng@gmx.de> | 2019-05-25 02:40:00 +0200 |
---|---|---|
committer | natrixaeria <janng@gmx.de> | 2019-05-25 02:40:00 +0200 |
commit | 04792563e216f57984219e582de491947e2d7f40 (patch) | |
tree | 69dbe9143271352122d90452a1cab8f8d391c77e | |
parent | 90be5f8d63e77ee51256270dec018e2c7448e115 (diff) |
Manipulate DOM
-rw-r--r-- | WebInterface/wasm/asm-paint/Cargo.toml | 1 | ||||
-rw-r--r-- | WebInterface/wasm/asm-paint/src/lib.rs | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/WebInterface/wasm/asm-paint/Cargo.toml b/WebInterface/wasm/asm-paint/Cargo.toml index c0a7c68..5713415 100644 --- a/WebInterface/wasm/asm-paint/Cargo.toml +++ b/WebInterface/wasm/asm-paint/Cargo.toml @@ -9,3 +9,4 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2" +web-sys = {version="0.3.22", features=["Window", "Document", "HtmlElement", "Node", "Element"]} diff --git a/WebInterface/wasm/asm-paint/src/lib.rs b/WebInterface/wasm/asm-paint/src/lib.rs index 52ddc8f..462a89d 100644 --- a/WebInterface/wasm/asm-paint/src/lib.rs +++ b/WebInterface/wasm/asm-paint/src/lib.rs @@ -12,5 +12,16 @@ extern "C" { #[wasm_bindgen(start)] pub fn entry() { + use web_sys; console_log!("hello {} wasm", 42); + + let window = web_sys::window().unwrap(); + + let document = window.document().unwrap(); + + let body = document.body().unwrap(); + + //body.set_inner_html("<marquee><h1 style='font-size: 100px'>Hello from WASM</h1></marquee>"); + + body.set_inner_html("oho"); } |