From 90be5f8d63e77ee51256270dec018e2c7448e115 Mon Sep 17 00:00:00 2001 From: natrixaeria Date: Sat, 25 May 2019 02:06:41 +0200 Subject: Resetup webassembly on the cool way --- WebInterface/wasm/asm-paint/src/lib.rs | 16 ++++++++++++++++ WebInterface/wasm/asm-paint/src/main.rs | 14 -------------- 2 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 WebInterface/wasm/asm-paint/src/lib.rs delete mode 100644 WebInterface/wasm/asm-paint/src/main.rs (limited to 'WebInterface/wasm/asm-paint/src') diff --git a/WebInterface/wasm/asm-paint/src/lib.rs b/WebInterface/wasm/asm-paint/src/lib.rs new file mode 100644 index 0000000..52ddc8f --- /dev/null +++ b/WebInterface/wasm/asm-paint/src/lib.rs @@ -0,0 +1,16 @@ +use wasm_bindgen::prelude::*; + +macro_rules! console_log { + ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) +} + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = console)] + fn log(s: &str); +} + +#[wasm_bindgen(start)] +pub fn entry() { + console_log!("hello {} wasm", 42); +} diff --git a/WebInterface/wasm/asm-paint/src/main.rs b/WebInterface/wasm/asm-paint/src/main.rs deleted file mode 100644 index f8949ee..0000000 --- a/WebInterface/wasm/asm-paint/src/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::os::raw::c_int; - -#[no_mangle] -pub extern fn run_infinite() { - std::thread::spawn(move || { - loop { - println!("iterating infititely"); - } - }); -} - -fn main() { - println!("haha from wasm lol"); -} -- cgit v1.3.1