Update app.js

This commit is contained in:
EthanThatOneKid 2021-01-12 16:55:48 -08:00 committed by GitHub
parent 662a64b067
commit 173daa0340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,8 +38,12 @@ const actions = {
document.querySelector(selectors.incompleteBtn).click();
const textarea = document.querySelector(selectors.notesTextarea);
textarea.focus();
isTypingFeedback = true;
const updateTextarea = setIdleTimeout(
() => document.querySelector(selectors.submit).focus(),
() => {
document.querySelector(selectors.submit).focus();
isTypingFeedback = false;
},
defaultIdleTimeout
);
textarea.addEventListener("keypress", updateTextarea);
@ -84,6 +88,9 @@ const actions = {
};
document.addEventListener("keypress", (event) => {
if (isTypingFeedback) {
return;
}
try {
switch (event.key) {
case "i":
@ -122,4 +129,6 @@ const main = () => {
actions.nextAssignment();
};
let isTypingFeedback = false;
main();