From 1e726bb3e04cc980e9edf805185c917c3e01a55d Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Sat, 25 Nov 2023 16:07:36 +0100 Subject: [PATCH] Fix scroll and visibilitychange event handling --- vendor/wasm/js/runtime.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/wasm/js/runtime.js b/vendor/wasm/js/runtime.js index 6a0146f4a..041fb949a 100644 --- a/vendor/wasm/js/runtime.js +++ b/vendor/wasm/js/runtime.js @@ -1451,11 +1451,11 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) { wmi.storeF64(off(8), e.deltaY); wmi.storeF64(off(8), e.deltaZ); wmi.storeU32(off(4), e.deltaMode); - } else if (e instanceof Event) { - if ('scrollX' in e) { - wmi.storeF64(off(8), e.scrollX); - wmi.storeF64(off(8), e.scrollY); - } + } else if (e.type === 'scroll') { + wmi.storeF64(off(8), window.scrollX); + wmi.storeF64(off(8), window.scrollY); + } else if (e.type === 'visibilitychange') { + wmi.storeU8(off(1), !document.hidden); } },