Added a repaint interval function for pages.meet (if active)

This commit is contained in:
Niko 2022-02-17 01:32:54 +01:00
parent e6e67b2b09
commit 7dabf832b6
1 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
app.pages.meet = {
data: [],
isActive: function() { return (window.location.hash+'/').startsWith('#meet/') },
load: function(args) {
document.querySelector('#page-meet').removeAttribute('style');
const dom = document.querySelector('#page-meet #content');
@ -10,6 +11,7 @@ app.pages.meet = {
app.pages.meet.data = json;
app.template.loadMany(['meet.item','meet.actions'], function(_) {
app.pages.meet.paint(json);
app.pages.meet.paintInterval();
});
});
},
@ -21,6 +23,15 @@ app.pages.meet = {
app.pages.meet.paint();
});
},
_paintInterval: false,
paintInterval: function() {
if (app.pages.meet.data._paintInterval) return;
app.pages.meet.data._paintInterval = true;
setInterval(function() {
if (app.pages.meet.isActive())
app.pages.meet.paint();
}, 1000 * 30);
},
paint: function(json) {
json = json || app.pages.meet.data;
let _;