Created
May 5, 2019 09:28
-
-
Save fvilches17/09f311370dc201ad94733d5d89757ce4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use wasm_bindgen::prelude::*; | |
#[wasm_bindgen] | |
pub fn greet() { | |
let window = web_sys::window().expect("no global `window` exists"); | |
let document = window.document().expect("should have a document on window"); | |
let header = document.get_element_by_id("greeting").unwrap(); | |
header.set_inner_html("<h1>[Rust Says] Hello Wasm!</h1>"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment