diff options
Diffstat (limited to 'WebInterface/wasm/asm-paint')
-rw-r--r-- | WebInterface/wasm/asm-paint/loader.js | 5 | ||||
-rw-r--r-- | WebInterface/wasm/asm-paint/src/lib.rs | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/WebInterface/wasm/asm-paint/loader.js b/WebInterface/wasm/asm-paint/loader.js index 8348c35..7313fa0 100644 --- a/WebInterface/wasm/asm-paint/loader.js +++ b/WebInterface/wasm/asm-paint/loader.js @@ -1,5 +1,6 @@ console.log('js> create import object'); -let importObject = { imports: { imported_func: arg => console.log(arg) } }; +let importObject = { imports: { my_alert: arg => alert(arg) } }; +//let importObject = {}; console.log('js> create fetch object'); @@ -9,7 +10,7 @@ console.log('js> instantiate streaming'); function and_then(obj) { console.log('js> reached instantiate streaming\'s then'); - return obj.instance.exports.exported_func(); + return obj.instance.exports.greet(); } WebAssembly.instantiateStreaming(asm_paint_bg, importObject) diff --git a/WebInterface/wasm/asm-paint/src/lib.rs b/WebInterface/wasm/asm-paint/src/lib.rs index 908b857..a4f4f54 100644 --- a/WebInterface/wasm/asm-paint/src/lib.rs +++ b/WebInterface/wasm/asm-paint/src/lib.rs @@ -10,10 +10,10 @@ static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[wasm_bindgen] extern { - fn log(s: &str); + fn my_alert(s: &str); } #[wasm_bindgen] pub fn greet() { - log("Hello, asm-paint!"); + my_alert("Hello, asm-paint!"); } |