mirror of
https://github.com/codeninjasgg/code-sensei.git
synced 2025-02-17 00:30:22 -05:00
Update app.js
This commit is contained in:
parent
662a64b067
commit
173daa0340
1 changed files with 10 additions and 1 deletions
|
@ -38,8 +38,12 @@ const actions = {
|
||||||
document.querySelector(selectors.incompleteBtn).click();
|
document.querySelector(selectors.incompleteBtn).click();
|
||||||
const textarea = document.querySelector(selectors.notesTextarea);
|
const textarea = document.querySelector(selectors.notesTextarea);
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
|
isTypingFeedback = true;
|
||||||
const updateTextarea = setIdleTimeout(
|
const updateTextarea = setIdleTimeout(
|
||||||
() => document.querySelector(selectors.submit).focus(),
|
() => {
|
||||||
|
document.querySelector(selectors.submit).focus();
|
||||||
|
isTypingFeedback = false;
|
||||||
|
},
|
||||||
defaultIdleTimeout
|
defaultIdleTimeout
|
||||||
);
|
);
|
||||||
textarea.addEventListener("keypress", updateTextarea);
|
textarea.addEventListener("keypress", updateTextarea);
|
||||||
|
@ -84,6 +88,9 @@ const actions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("keypress", (event) => {
|
document.addEventListener("keypress", (event) => {
|
||||||
|
if (isTypingFeedback) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "i":
|
case "i":
|
||||||
|
@ -122,4 +129,6 @@ const main = () => {
|
||||||
actions.nextAssignment();
|
actions.nextAssignment();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let isTypingFeedback = false;
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
Loading…
Reference in a new issue