feat(nds): physical dpad

This commit is contained in:
2025-12-14 18:58:22 +01:00
parent cc4f2589ca
commit 7aa0225c2f
2 changed files with 170 additions and 48 deletions

View File

@@ -0,0 +1,15 @@
export type KeyUpCallback = (key: string) => void;
export const useKeyUp = (callback: KeyUpCallback) => {
const handleKeyUp = (event: KeyboardEvent) => {
callback(event.key);
};
onMounted(() => {
window.addEventListener("keyup", handleKeyUp);
});
onUnmounted(() => {
window.removeEventListener("keyup", handleKeyUp);
});
};