mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-28 19:08:32 +08:00
refactor: replace jQuery with DOM utils for alt and shift key trackers (@MoushufAlam) (#7266)
### Description Replaces jQuery usage with DOM utils for alt and shift key trackers. Scope intentionally kept small per contributing guidelines. ### Checks - [x] Adding/modifying Typescript code? - [x] I have used `qs`, `qsa` or `qsr` instead of JQuery selectors. - [x] Check if any open issues are related to this PR; if so, be sure to tag them below. - [x] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info) - [x] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title. <!-- label(optional scope): pull request title (@your_github_username) --> <!-- I know I know they seem boring but please do them, they help us and you will find out it also helps you.--> Related to #7186 <!-- the issue(s) your PR resolves if any (delete if that is not the case) --> <!-- please also reference any issues and or PRs related to your pull request --> <!-- Also remove it if you are not following any issues. --> <!-- pro tip: you can mention an issue, PR, or discussion on GitHub by referencing its hash number e.g: [#1234](https://github.com/monkeytypegame/monkeytype/pull/1234) --> <!-- pro tip: you can press . (dot or period) in the code tab of any GitHub repo to get access to GitHub's VS Code web editor Enjoy! :) -->
This commit is contained in:
parent
d6a6dad552
commit
9e93af465f
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
export let leftState = false;
|
||||
export let rightState = false;
|
||||
|
||||
$(document).on("keydown", (e) => {
|
||||
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
if (e.code === "AltLeft") {
|
||||
leftState = true;
|
||||
} else if (e.code === "AltRight") {
|
||||
|
|
@ -9,7 +9,7 @@ $(document).on("keydown", (e) => {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on("keyup", (e) => {
|
||||
document.addEventListener("keyup", (e: KeyboardEvent) => {
|
||||
if (e.code === "AltLeft") {
|
||||
leftState = false;
|
||||
} else if (e.code === "AltRight") {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import * as KeyConverter from "../utils/key-converter";
|
|||
export let leftState = false;
|
||||
export let rightState = false;
|
||||
|
||||
$(document).on("keydown", (e) => {
|
||||
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
if (e.code === "ShiftLeft") {
|
||||
leftState = true;
|
||||
rightState = false;
|
||||
|
|
@ -14,7 +14,7 @@ $(document).on("keydown", (e) => {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on("keyup", (e) => {
|
||||
document.addEventListener("keyup", (e: KeyboardEvent) => {
|
||||
if (e.code === "ShiftLeft" || e.code === "ShiftRight") {
|
||||
leftState = false;
|
||||
rightState = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue