git-watchtower 1.14.14 → 1.14.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "1.14.14",
3
+ "version": "1.14.15",
4
4
  "description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
5
5
  "main": "bin/git-watchtower.js",
6
6
  "bin": {
@@ -105,6 +105,11 @@ function disable() {
105
105
  // effect on the way out, which the user just asked to stop.
106
106
  resetSlotState();
107
107
  stopWinAnimation();
108
+ // resetLossState — stop the loss interval AND clear lossMessage. Without
109
+ // this, a triggerLoss() in flight kept lossAnimationInterval firing for
110
+ // up to ~15 frames × 120 ms = 1.8 s after disable, and lossMessage stayed
111
+ // set so isLossAnimating() reported true into the next session.
112
+ resetLossState();
108
113
  }
109
114
 
110
115
  /**
@@ -563,6 +568,18 @@ function stopLossAnimation() {
563
568
  }
564
569
  }
565
570
 
571
+ /**
572
+ * Clear all loss animation state without side effects. Used by disable()
573
+ * so a loss in flight at the moment casino mode is turned off doesn't
574
+ * keep its interval running or leave lossMessage set for isLossAnimating().
575
+ * @private
576
+ */
577
+ function resetLossState() {
578
+ stopLossAnimation();
579
+ lossMessage = null;
580
+ lossAnimationFrame = 0;
581
+ }
582
+
566
583
  /**
567
584
  * Get loss animation display
568
585
  * @param {number} width
@@ -586,6 +603,7 @@ function getLossDisplay(width) {
586
603
  * @returns {boolean}
587
604
  */
588
605
  function isLossAnimating() {
606
+ if (!casinoEnabled) return false;
589
607
  return lossMessage !== null;
590
608
  }
591
609