summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/asm-paint/src
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/wasm/asm-paint/src')
-rw-r--r--WebInterface/wasm/asm-paint/src/lib.rs16
-rw-r--r--WebInterface/wasm/asm-paint/src/main.rs14
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");
-}