From 55f5b6680a4a0f9cc721a50e926f9d1d76e76066 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 3 Jun 2021 22:09:32 -0400 Subject: Timer: Don't start and stop updating with controller connects/disconnects --- app/javascript/controllers/timer_controller.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js index 901ec0a..ef741bf 100644 --- a/app/javascript/controllers/timer_controller.js +++ b/app/javascript/controllers/timer_controller.js @@ -13,16 +13,9 @@ export default class extends Controller { this.counter = this.startValue; this.timerTarget.textContent = this.counter; this.postFailures = 0; - } - - connect() { this.startUpdating(); } - disconnect() { - this.stopUpdating(); - } - startUpdating() { let controller = this; this.timerInterval = setInterval(() => { @@ -50,10 +43,4 @@ export default class extends Controller { } }, 1000); } - - stopUpdating() { - if (this.timerInterval) { - clearInterval(this.timerInterval); - } - } } -- cgit v1.2.3