From 5e83e646b28bab81581125209aa12a92213c08d7 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Mon, 9 Nov 2026 04:23:31 -0500 Subject: [PATCH] Added automatic refreshing to channel guide --- www/js/channelGuide.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/www/js/channelGuide.js b/www/js/channelGuide.js index 50447f1..30cbaf2 100644 --- a/www/js/channelGuide.js +++ b/www/js/channelGuide.js @@ -16,6 +16,10 @@ along with this program. If not, see .*/ class ChannelGuide{ constructor(){ + //define property to hold refresh timer + this.refreshTimer; + + //Grab DOM Nodes this.scheduleIndex = document.querySelector('#channel-guide-schedule-index'); this.channelList = document.querySelector('#channel-guide-channel-list'); this.scheduledMediaDiv = document.querySelector('#channel-guide-scheduled-media'); @@ -30,10 +34,22 @@ class ChannelGuide{ } renderList(schedule, now = new Date()){ - this.renderIndex(now); + this.renderIndex(now) + + //if we've got a job to refresh the list + if(this.refreshTimer != null){ + //cancel it + clearTimeout(this.refreshTimer); + } + + //Set timer to refresh the thing erry minute + setTimeout(this.refreshList.bind(this), 1000 * 60); } renderIndex(now = new Date()){ + //Clear schedule index + this.scheduleIndex.innerHTML = ''; + //DO EM 3 TEIMS! for(let slot = 0; slot < 3; slot++){ //Clone passed date object to prevent over-writing