Added automatic refreshing to channel guide
This commit is contained in:
parent
c3483627d8
commit
5e83e646b2
1 changed files with 17 additions and 1 deletions
|
|
@ -16,6 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||||
|
|
||||||
class ChannelGuide{
|
class ChannelGuide{
|
||||||
constructor(){
|
constructor(){
|
||||||
|
//define property to hold refresh timer
|
||||||
|
this.refreshTimer;
|
||||||
|
|
||||||
|
//Grab DOM Nodes
|
||||||
this.scheduleIndex = document.querySelector('#channel-guide-schedule-index');
|
this.scheduleIndex = document.querySelector('#channel-guide-schedule-index');
|
||||||
this.channelList = document.querySelector('#channel-guide-channel-list');
|
this.channelList = document.querySelector('#channel-guide-channel-list');
|
||||||
this.scheduledMediaDiv = document.querySelector('#channel-guide-scheduled-media');
|
this.scheduledMediaDiv = document.querySelector('#channel-guide-scheduled-media');
|
||||||
|
|
@ -30,10 +34,22 @@ class ChannelGuide{
|
||||||
}
|
}
|
||||||
|
|
||||||
renderList(schedule, now = new Date()){
|
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()){
|
renderIndex(now = new Date()){
|
||||||
|
//Clear schedule index
|
||||||
|
this.scheduleIndex.innerHTML = '';
|
||||||
|
|
||||||
//DO EM 3 TEIMS!
|
//DO EM 3 TEIMS!
|
||||||
for(let slot = 0; slot < 3; slot++){
|
for(let slot = 0; slot < 3; slot++){
|
||||||
//Clone passed date object to prevent over-writing
|
//Clone passed date object to prevent over-writing
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue