Skip to content

Commit

Permalink
Undo previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMicroNova committed Dec 20, 2024
1 parent 53efe99 commit ac0618a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web/src/components/CustomMarquee/CustomMarquee.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ export default function CustomMarquee(props) {
}
}

let resizeTimeout; // Your IDE will say this is unused, it's actually used to make sure the timeout below is limited to one instance at a time by taking up a specific variable
function handleResize(){
if(!resizeCooldown.current){
resizeCooldown.current = true;

assessMarquee()
resizeTimeout = setTimeout(()=>{resizeCooldown.current = false;}, 1000)
}
}
window.addEventListener("resize", handleResize()); // Doesn't call assessMarquee directly to avoid calling thousands of times per second when resizing window
Expand Down

0 comments on commit ac0618a

Please sign in to comment.