mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
Move filter function into seperate method
This commit is contained in:
parent
9b93066cbe
commit
0ac5032db9
@ -90,13 +90,19 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
data = ical.parseICS(responseData);
|
data = ical.parseICS(responseData);
|
||||||
|
Log.debug("parsed data=" + JSON.stringify(data));
|
||||||
|
filterEvents(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
fetchFailedCallback(self, error.message);
|
fetchFailedCallback(self, error.message);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
self.broadcastEvents();
|
||||||
|
scheduleTimer();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Log.debug(" parsed data=" + JSON.stringify(data));
|
const filterEvents = function (data) {
|
||||||
|
|
||||||
const newEvents = [];
|
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
|
// 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;
|
if (entries > maximumEntries) break;
|
||||||
events.push(ne);
|
events.push(ne);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.broadcastEvents();
|
|
||||||
scheduleTimer();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user