Skip to content

Commit

Permalink
Reset the timer upon regenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
jerjou committed Apr 14, 2021
1 parent f9d36b8 commit d466b5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions math.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ let makeSum = (min, max, n=2) => {
return [sum, ...nums];
};

function resetTimer() {
let form = $('form');
delete form.startTime;
$('div.time').innerHTML = '';
}
function timer(e) {
let form = $('form');
if (!form.startTime) {
Expand Down Expand Up @@ -121,6 +126,7 @@ addEventListener('DOMContentLoaded', _ => {
e.preventDefault();
let form = generateProblems(numProbs, min, max, mix);
container.replaceChild(form, container.childNodes[0]);
resetTimer();
});
container.appendChild(regenerate);

Expand Down

0 comments on commit d466b5b

Please sign in to comment.