Mark van Renswoude
88beaa6f7d
Added the feature to override email templates Added automatic refresh of disk space indicator
45 lines
594 B
JavaScript
45 lines
594 B
JavaScript
class AbstractIntervalWorker
|
|
{
|
|
start(interval)
|
|
{
|
|
var self = this;
|
|
|
|
self.stop();
|
|
self.timer = setInterval(async () =>
|
|
{
|
|
if (self.ticking)
|
|
return;
|
|
|
|
self.ticking = true;
|
|
try
|
|
{
|
|
await self.tick();
|
|
}
|
|
catch (err)
|
|
{
|
|
console.log(err);
|
|
}
|
|
self.ticking = false;
|
|
}, interval);
|
|
}
|
|
|
|
|
|
stop()
|
|
{
|
|
var self = this;
|
|
if (self.timer)
|
|
{
|
|
clearInterval(self.timer);
|
|
self.timer = null;
|
|
}
|
|
}
|
|
|
|
|
|
/* Implement this:
|
|
async tick()
|
|
{
|
|
}
|
|
*/
|
|
}
|
|
|
|
module.exports = AbstractIntervalWorker; |