From 13696f1f82cf96cdac25018a820eb284a38ac5b3 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 26 May 2025 04:30:07 +0200 Subject: [PATCH] Refactor cleanup function in animeCat.js --- animeCat.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/animeCat.js b/animeCat.js index 7448afd..0e1def0 100644 --- a/animeCat.js +++ b/animeCat.js @@ -263,14 +263,13 @@ _bindMouseHold() { const onUpBound = onUp.bind(this); - function cleanup() { + const cleanup = () => { window.removeEventListener('mousemove', onMoveBound); window.removeEventListener('mouseup', onUpBound); if (holdTimer) clearTimeout(holdTimer); holdTimer = null; - this._pettingActive = false; // <--- Hier sauber zurücksetzen! - } - + this._pettingActive = false; // Korrekt! + }; window.addEventListener('mousemove', onMoveBound); window.addEventListener('mouseup', onUpBound);