diff --git a/pkg/ludus.js b/pkg/ludus.js index 30af0be..01747fa 100644 --- a/pkg/ludus.js +++ b/pkg/ludus.js @@ -85,7 +85,7 @@ function io_poller () { outbox = [] } if (ready && running) { - if (keys_down.size > 0) bundle_keys() + bundle_keys() worker.postMessage(outbox) outbox = [] } diff --git a/pkg/rudus_bg.wasm b/pkg/rudus_bg.wasm index 12e1102..c32cc82 100644 Binary files a/pkg/rudus_bg.wasm and b/pkg/rudus_bg.wasm differ diff --git a/pkg/worker.js b/pkg/worker.js index fc935f0..6b948b7 100644 --- a/pkg/worker.js +++ b/pkg/worker.js @@ -18,7 +18,7 @@ export function io (out) { resolve(JSON.stringify(e.data)) } // cancel the response if it takes too long - setTimeout(() => reject("io took too long"), 1000) + setTimeout(() => reject(`io took too long to respond to ${out}`), 1000) }) } diff --git a/src/io.rs b/src/io.rs index cf8fbe7..a50bb3f 100644 --- a/src/io.rs +++ b/src/io.rs @@ -86,14 +86,14 @@ pub async fn do_io (msgs: Vec) -> Vec { let inbox = match inbox { Ok(msgs) => msgs, Err(errs) => { - console_log!("error receiving messages in io; {:?}", errs); + // console_log!("error receiving messages in io; {:?}", errs); return vec![]; } }; let inbox = inbox.as_string().expect("response should be a string"); let inbox: Vec = serde_json::from_str(inbox.as_str()).expect("response from js should be valid"); if !inbox.is_empty() { - console_log!("ludus received messages"); + // console_log!("ludus received messages"); for msg in inbox.iter() { console_log!("{}", msg); } diff --git a/src/world.rs b/src/world.rs index fb91c6f..5a3e85c 100644 --- a/src/world.rs +++ b/src/world.rs @@ -472,6 +472,7 @@ impl World { } fn register_keys(&mut self, keys: Value) { + // console_log!("New keys: {keys}"); let keys_down_rc = self.buffers.keys_down(); keys_down_rc.replace(keys); }