Skip to content

Instantly share code, notes, and snippets.

Created Oct 5, 2018
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