silvrgit/lib/caltest.js
2017-10-13 10:39:58 +01:00

69 lines
1.6 KiB
JavaScript

var log4js = require('log4js');
var logger = log4js.getLogger();
var calHandler = require('./today/calHandler');
require('sugar-date');
var cal = { 'today': [], 'tomorrow': [], 'week': [] };
var _cal_tmp = { 'today': [], 'tomorrow': [], 'week': [] };
/*
for (var t = 0; t < calHandler.calendars.length;t++)
calHandler.getAdvancedCalV3(calHandler.calendars[t])
.then((d) => {
'use strict';
// cal.today = cal.today.concat(d.today);
// cal.tomorrow = cal.tomorrow.concat(d.tomorrow);
cal.week = cal.week.concat(d.week);
logger.info(cal);
})
.catch((e) => {
'use strict';
logger.error(e);
});
*/
for (const item of calHandler.calendars)
calHandler.getAdvancedCalV3(item)
.then((d) => {
'use strict';
// cal.today = cal.today.concat(d.today);
// cal.tomorrow = cal.tomorrow.concat(d.tomorrow);
cal.week = cal.week.concat(d.week);
logger.info(cal);
})
.catch((e) => {
'use strict';
logger.error(e);
});
/*calHandler.getSimpleCalV3(
'http://www.pogdesign.co.uk/cat/download_ics/60cfdff469d0490545d33d7e3b5c0bcc')
.then((d) => {
'use strict';
let tv = d;
logger.info(tv);
})
.catch((e) => {
'use strict';
logger.error(e);
});*/
/*calHandler.getAdvancedCalV3(calHandler.calendars[4])
.then((d) => {
'use strict';
// cal.today = cal.today.concat(d.today);
// cal.tomorrow = cal.tomorrow.concat(d.tomorrow);
cal.week = cal.week.concat(d.week);
logger.error(cal);
})
.catch((e) => {
'use strict';
logger.error(e);
});*/