typo, remove dead code, comments, fix recurring refresh, let fetcher handle it

This commit is contained in:
Sam Detweiler
2020-10-12 09:01:50 -05:00
parent e8f60d39de
commit 4a7cb88a3e
3 changed files with 12 additions and 21 deletions

View File

@@ -29,7 +29,7 @@ Module.register("calendar", {
timeFormat: "relative",
dateFormat: "MMM Do",
dateEndFormat: "LT",
fullDayEventDateFormat: "MMM Do HH:mm",
fullDayEventDateFormat: "MMM Do",
showEnd: false,
getRelative: 6,
fadePoint: 0.25, // Start on 1/4th of the list.
@@ -41,7 +41,7 @@ Module.register("calendar", {
calendars: [
{
symbol: "calendar",
url: "https://www.calendarlabs.com/templates/ical/US-Holidays.ics1"
url: "https://www.calendarlabs.com/templates/ical/US-Holidays.ics"
}
],
titleReplace: {
@@ -85,6 +85,12 @@ Module.register("calendar", {
// Set locale.
moment.updateLocale(config.language, this.getLocaleSpecification(config.timeFormat));
// clear data holder before start
this.calendarData = {};
// indicate no data available yet
this.loaded = false;
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://");
@@ -114,18 +120,10 @@ Module.register("calendar", {
};
}
// tell helper to start a fetcher for this calendar
// fetcher till cycle
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
/* // Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar
// fetcher running on the server side.
var self = this;
setInterval(function () {
self.addCalendar(calendar.url, calendar.auth, calendarConfig);
}, self.config.fetchInterval); */
}
this.calendarData = {};
this.loaded = false;
},
// Override socket notification handler.
@@ -558,9 +556,6 @@ Module.register("calendar", {
auth: auth,
broadcastPastEvents: calendarConfig.broadcastPastEvents || this.config.broadcastPastEvents
});
setTimeout(() => {
self.addCalendar(url, auth, calendarConfig);
}, self.config.fetchInterval);
},
/**