Add an example of console.log

Also clean up some other exampels
This commit is contained in:
Alex Crichton
2018-03-09 10:25:19 -08:00
parent 8b74c6c6ec
commit d8e5930799
17 changed files with 111 additions and 21 deletions

View File

@ -0,0 +1,18 @@
#![feature(proc_macro)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
type console;
#[wasm_bindgen(static = console)]
fn log(s: &str);
}
#[wasm_bindgen]
pub fn run() {
console::log("Hello from Rust!");
}