Skip to content

Instantly share code, notes, and snippets.

Created October 5, 2018 02:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
extern crate wasm_bindgen;
extern crate web_sys;
use wasm_bindgen::prelude::*;
pub fn run() -> Result<(), JsValue> {
let window = web_sys::window().expect("no global `window` exists");
let document = window.document().expect("should have a document on window");
let body = document.body().expect("document should have a body");
let val = document.create_element("p")?;
val.set_inner_html("Hello from Rust!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment