forked from adrukh/MagicMirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.js
33 lines (24 loc) · 1001 Bytes
/
debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* CalendarFetcher Tester
* use this script with `node debug.js` to test the fetcher without the need
* of starting the MagicMirror core. Adjust the values below to your desire.
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*/
var CalendarFetcher = require("./calendarfetcher.js");
var url = 'https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics';
var fetchInterval = 60 * 60 * 1000;
var maximumEntries = 10;
var maximumNumberOfDays = 365;
console.log('Create fetcher ...');
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
fetcher.onReceive(function(fetcher) {
console.log(fetcher.events());
console.log('------------------------------------------------------------');
});
fetcher.onError(function(fetcher, error) {
console.log("Fetcher error:");
console.log(error);
});
fetcher.startFetch();
console.log('Create fetcher done! ');