summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/webhogg/src
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/wasm/webhogg/src')
-rw-r--r--WebInterface/wasm/webhogg/src/client_logger.rs3
-rw-r--r--WebInterface/wasm/webhogg/src/lib.rs23
2 files changed, 19 insertions, 7 deletions
diff --git a/WebInterface/wasm/webhogg/src/client_logger.rs b/WebInterface/wasm/webhogg/src/client_logger.rs
index f71918f..f537631 100644
--- a/WebInterface/wasm/webhogg/src/client_logger.rs
+++ b/WebInterface/wasm/webhogg/src/client_logger.rs
@@ -32,8 +32,9 @@ fn log(rec: &log::Record) {
pub fn init_logger() {
fern::Dispatch::new().format(|out, message, record|{
out.finish(format_args!(
- "%c{}%c {} > {}",
+ "%c{}%c |{}| {} > {}",
record.level(),
+ String::from(js_sys::Date::new_0().to_iso_string()),
record.target(),
message
)
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");