diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-06-02 13:18:44 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-06-02 13:18:44 +0200 |
commit | ee573fd1a02d290ec2aa9201d923805b6d998b14 (patch) | |
tree | 6b5fc62e633e227984a8ad68d4d54e695eca82b7 /WebInterface/wasm/webhogg/src/lib.rs | |
parent | 23c14642b1d93905ab9bc86ca821183dd4a97f8c (diff) | |
parent | d9f7a4b1a39ecb8e91e3f7c4d2d0c140d2589fa2 (diff) |
Merge branch 'webhogg' of github.com:TrueDoctor/DiscoBot into webhogg
Diffstat (limited to 'WebInterface/wasm/webhogg/src/lib.rs')
-rw-r--r-- | WebInterface/wasm/webhogg/src/lib.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/WebInterface/wasm/webhogg/src/lib.rs b/WebInterface/wasm/webhogg/src/lib.rs index 9d052cd..2ee7267 100644 --- a/WebInterface/wasm/webhogg/src/lib.rs +++ b/WebInterface/wasm/webhogg/src/lib.rs @@ -22,20 +22,31 @@ fn run_application() { pub fn game_logic_entry(worker: web_sys::Worker) { client_logger::init_logger(); - info!("game logic initialisation"); - info!("js value: {:?}", worker); - worker.post_message(&wasm_bindgen::JsValue::from_str("msg frm wasm_gLe")).unwrap(); + info!("hello from game logic wasm"); + info!("begin long calculation in game logic thread"); + worker.post_message(&wasm_bindgen::JsValue::from_str("premsg frm wasm_gLe")) + .unwrap(); + info!("killed game logic"); } #[wasm_bindgen] -pub fn graphics_entry() { +pub fn graphics_entry(worker: web_sys::DedicatedWorkerGlobalScope, + canvas: web_sys::OffscreenCanvas) { client_logger::init_logger(); - info!("graphics initialisation"); + info!("hello from graphics wasm {:?}", canvas); + let handler = wasm_bindgen::closure::Closure::once_into_js( + (|e: web_sys::MessageEvent| { + info!("things are getting wired: {:?}", e.data()); + })); + + worker.set_onmessage(Some(&js_sys::Function::from(handler))); + entry2(); + info!("killed graphics"); } pub fn entry2() { - client_logger::init_logger(); + // client_logger::init_logger(); info!("begin running wasm application"); |