Move filter function into seperate method

This commit is contained in:
rejas 2020-12-25 12:59:08 +01:00
parent 9b93066cbe
commit 0ac5032db9

View File

@ -90,13 +90,19 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
try {
data = ical.parseICS(responseData);
Log.debug("parsed data=" + JSON.stringify(data));
filterEvents(data);
} catch (error) {
fetchFailedCallback(self, error.message);
scheduleTimer();
return;
}
self.broadcastEvents();
scheduleTimer();
});
};
Log.debug(" parsed data=" + JSON.stringify(data));
const filterEvents = function (data) {
const newEvents = [];
// limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves
@ -419,10 +425,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
if (entries > maximumEntries) break;
events.push(ne);
}
self.broadcastEvents();
scheduleTimer();
});
};
/**