mirror of
https://github.com/speice-io/isomorphic-rust
synced 2025-08-28 02:04:55 -04:00
Add a minimal and plain stdweb example
This commit is contained in:
18
stdweb/src/lib.rs
Normal file
18
stdweb/src/lib.rs
Normal file
@ -0,0 +1,18 @@
|
||||
#![feature(custom_attribute)]
|
||||
|
||||
extern crate stdweb;
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use stdweb::web::document;
|
||||
use stdweb::web::INode;
|
||||
use stdweb::web::IElement;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn run() {
|
||||
let doc = document();
|
||||
let val = doc.create_element("p").unwrap();
|
||||
val.set_attribute("innerHTML", "IT IS ALIVE").unwrap();
|
||||
doc.body().unwrap().append_child(&val);
|
||||
}
|
Reference in New Issue
Block a user