Added a countdown timer
This commit is contained in:
parent
70a782d0e4
commit
89a6b4d062
6 changed files with 115 additions and 16 deletions
|
|
@ -70,16 +70,15 @@ export class GameController extends Controller {
|
|||
this.problemTarget.appendChild(div);
|
||||
}
|
||||
|
||||
this.answerTarget.disabled = false;
|
||||
this.answerTarget.value = "";
|
||||
this.answerTarget.focus();
|
||||
|
||||
window.setTimeout(() => {
|
||||
this.answerTarget.focus();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
_checkAnswer() {
|
||||
let isRight = parseInt(this.answerTarget.value) === this._answer;
|
||||
|
||||
this.answerTarget.disabled = true;
|
||||
|
||||
let delay = 500;
|
||||
|
||||
if (isRight) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue