Added automatic refreshing to channel guide

This commit is contained in:
rainbow napkin 2026-11-09 04:23:31 -05:00
parent c3483627d8
commit 5e83e646b2

View file

@ -16,6 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
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