feat: implemented a basic store and emulatorjs

This commit is contained in:
Simeon Radivoev 2026-03-14 02:15:57 +02:00
parent 2f32cbc730
commit 7286541822
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
121 changed files with 5900 additions and 1092 deletions

View file

@ -51,6 +51,7 @@ function markDirtyThrottled ()
window.addEventListener('focuschanged', markDirtyThrottled);
import.meta.hot?.dispose(() => window.removeEventListener('focuschanged', markDirtyThrottled));
import.meta.hot?.dispose(() => shortcutMap.clear());
export function useShortcutContext ()
{
@ -81,6 +82,12 @@ export function useShortcutContext ()
const handleGamepadButtonDown = (e: Event) =>
{
const event = e as GamepadButtonEvent;
if (event.button == GamePadButtonCode.B && document.fullscreenElement)
{
document.exitFullscreen();
return;
}
if (shortcuts.has(event.button))
{
shortcuts.get(event.button)?.action?.(event);
@ -166,6 +173,7 @@ export function useShortcuts (focusKey: string, build: () => Shortcut[], ...deps
return () =>
{
shortcutMap.delete(focusKey);
markDirtyThrottled();
};
}, [...deps, focusKey]);