Skip to content

Commit

Permalink
Fix getLayoutMap() bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Angus committed Aug 1, 2024
1 parent 057bf17 commit c577744
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/utils/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ export async function getKeyboardKeyForCode(code: string, fallback: string): Pro
return fallback;
}

const map = await keyboard.getLayoutMap();
const key = map.get(code);
try {
const map = await keyboard.getLayoutMap();

return key || fallback;
const key = map.get(code);

return key || fallback;
} catch (e) {
console.log(e);
return fallback;
}
}

0 comments on commit c577744

Please sign in to comment.