diff options
| author | natrixaeria <janng@gmx.de> | 2019-05-25 02:06:41 +0200 |
|---|---|---|
| committer | natrixaeria <janng@gmx.de> | 2019-05-25 02:06:41 +0200 |
| commit | 90be5f8d63e77ee51256270dec018e2c7448e115 (patch) | |
| tree | 949159bcdc5cdff23a73f5f03172a17897a87e7c /WebInterface/wasm/asm-paint/src | |
| parent | 233106ee4fc302579af0224611e55be5b1479f51 (diff) | |
Resetup webassembly on the cool way
Diffstat (limited to 'WebInterface/wasm/asm-paint/src')
| -rw-r--r-- | WebInterface/wasm/asm-paint/src/lib.rs | 16 | ||||
| -rw-r--r-- | WebInterface/wasm/asm-paint/src/main.rs | 14 |
2 files changed, 16 insertions, 14 deletions
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"); -} |
