Skip to content

Instantly share code, notes, and snippets.

@fvilches17
Created May 5, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fvilches17/09f311370dc201ad94733d5d89757ce4 to your computer and use it in GitHub Desktop.
Save fvilches17/09f311370dc201ad94733d5d89757ce4 to your computer and use it in GitHub Desktop.
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