Make benchmark work on native

This commit is contained in:
2026-11-23 20:01:25 -03:00
parent 90dd86b336
commit ced27d3400
5 changed files with 21 additions and 17 deletions
+4 -2
View File
@@ -92,9 +92,11 @@ export const browser_platform: Platform = {
return localStorage;
},
on_shown(shown) {
document.addEventListener("visibilitychange", () => {
const listener = () => {
if (!document.hidden) shown();
});
};
document.addEventListener("visibilitychange", listener);
return () => document.removeEventListener("visibilitychange", listener);
},
// sprinting is ctrl and walking is w, and ctrl+w closes the tab without the page getting a say. in fullscreen
// the keyboard lock catches it instead (see browser_input.ts)