Skip to content

Commit

Permalink
fix: event listeners fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
EternoSeeker committed Mar 1, 2024
1 parent df44882 commit b94a9ec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ function startAnimation() {
// check if the grid is empty,
// if not then start the animation and start the game
if (!areEventListenersremoved) {
areEventListenersremoved = true;
removeEventListenersFromCells();
areEventListenersremoved = true;
}
const playPauseIcon = document.getElementById("play-pause-icon");
if (isEmpty()) {
Expand Down Expand Up @@ -172,8 +172,10 @@ function clearGrid() {
drawCells();
}
isStarted = false;
areEventListenersremoved = false;
addEventListenersToCells();
if(areEventListenersremoved){
addEventListenersToCells();
areEventListenersremoved = false;
}
}

function animate() {
Expand Down

0 comments on commit b94a9ec

Please sign in to comment.