-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapp.js
564 lines (475 loc) · 24.1 KB
/
app.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
'use strict'
const Homey = require('homey')
const ical = require('node-ical')
const varMgmt = require('./lib/variable-management')
const getDateTimeFormat = require('./lib/get-datetime-format')
const hasData = require('./lib/has-data')
const getActiveEvents = require('./lib/get-active-events')
const getFallbackUri = require('./lib/get-fallback-uri')
const filterUpdatedCalendars = require('./lib/filter-updated-calendars')
const getEventUids = require('./lib/get-event-uids')
const getNewEvents = require('./lib/get-new-events')
const { getLocalActiveEvents, saveLocalEvents } = require('./lib/local-events')
const sortCalendarsEvents = require('./lib/sort-calendars')
const { generateTokens, generatePerCalendarTokens, generateNextEventTokens } = require('./lib/generate-token-configuration')
const { resetTodayHitCount } = require('./lib/hit-count')
const { triggerChangedCalendars, triggerEvents, triggerSynchronizationError } = require('./handlers/trigger-cards')
const setupTriggers = require('./handlers/setup-triggers')
const setupFlowTokens = require('./handlers/setup-flow-tokens')
const { setupConditions } = require('./handlers/setup-conditions')
const setupActions = require('./handlers/setup-actions')
const { updateTokens } = require('./handlers/update-tokens')
const { addJob, isValidCron } = require('./handlers/cron')
const { moment } = require('./lib/moment-datetime')
class IcalCalendar extends Homey.App {
/**
* onInit is called when the app is initialized.
*/
async onInit () {
/* if (process.env.DEBUG === '1') {
try {
require('inspector').waitForDebugger()
this.log('Attached inspector')
} catch (error) {
require('inspector').open(9222, '0.0.0.0', true)
this.log('Attached inspector:9222')
}
} */
// convenience function for getting current timezone
this.getTimezone = () => this.homey.clock.getTimezone()
// convenience functions for logging
this.warn = (...args) => this.log('[WARN]', ...args)
this.logError = (...args) => {
this.error('[ERROR]', ...args)
}
this.log(`${Homey.manifest.name.en} v${Homey.manifest.version} is running on firmware ${this.homey.version} with Timezone: '${this.getTimezone()}'`)
// set a variable to control if getEvents is already running
this.isGettingEvents = false
// register variableMgmt to this app class
this.variableMgmt = varMgmt
// get date and time format as an object
this.variableMgmt.dateTimeFormat = getDateTimeFormat(this)
setupTriggers(this)
await setupFlowTokens(this)
this.getSyncInterval()
// register cron jobs
this.startJobs()
// setup conditions
setupConditions(this, this.getTimezone())
// setup actions
setupActions(this)
// get ical events
this.log('onInit: Triggering getEvents and reregistering tokens')
this.getEvents(true)
// register callback when settings has been set
this.registerSettingCallbacks()
this._unload = (name) => {
this.variableMgmt = null
if (!this.jobs) return
// unload cron jobs
Object.getOwnPropertyNames(this.jobs).forEach((prop) => {
if (typeof this.jobs[prop].stop === 'function') {
this.log(`${name}/_unload: Job '${prop}' will be stopped`)
this.jobs[prop].stop()
}
})
}
this.homey.on('unload', () => {
if (typeof this._unload !== 'function') {
this.warn('unload -- this._unload is not a function')
return
}
this.log('unload -- calling this._unload')
this._unload('unload')
})
}
getSyncInterval () {
const syncInterval = this.homey.settings.get(this.variableMgmt.setting.syncInterval)
if (syncInterval) {
this.log('onInit: Sync interval settings:', syncInterval)
return
}
const syncIntervalDefault = { auto: true, cron: '15 */15 * * * *' }
this.homey.settings.set(this.variableMgmt.setting.syncInterval, syncIntervalDefault)
this.log('onInit: Default sync interval settings set:', syncIntervalDefault)
}
registerSettingCallbacks () {
this.homey.settings.on('set', (args) => {
if (args && [this.variableMgmt.setting.icalUris, this.variableMgmt.setting.eventLimit, this.variableMgmt.setting.nextEventTokensPerCalendar].includes(args)) {
// sync calendars when calendar specific settings have been changed
if (this.isGettingEvents) {
this.log(`onInit/${args}: "getEvents" is currently running. Updated settings won't be applied until the next 15th minute!`)
return
}
this.log(`onInit/${args}: Triggering getEvents and reregistering tokens`)
this.getEvents(true)
return
}
if (args && [this.variableMgmt.setting.dateFormatLong, this.variableMgmt.setting.dateFormatShort, this.variableMgmt.setting.timeFormat].includes(args)) {
// get new date/time format
this.variableMgmt.dateTimeFormat = getDateTimeFormat(this)
return
}
if (args && [this.variableMgmt.setting.syncInterval].includes(args)) {
// adjust synchronization interval
this.startJobs('update')
}
})
}
getWorkTime (start, end) {
const seconds = (end - start) / 1000
if (seconds > 60) {
return `${seconds / 60} minutes`
}
return `${seconds} seconds`
}
async getEvents (reregisterCalendarTokens = false) {
this.isGettingEvents = true
// errors to return
const errors = []
// get URI from settings
const calendars = this.homey.settings.get(this.variableMgmt.setting.icalUris)
// calendars not entered in settings page yet
if (!calendars || (Array.isArray(calendars) && calendars.length === 0)) {
this.warn('getEvents: Calendars has not been set in Settings yet')
this.isGettingEvents = false
this.gettingEventsLastRun = new Date()
if (this.jobs && this.jobs.update && typeof this.jobs.update.nextRun === 'function') {
this.log(`getEvents: Next update in UTC: ${this.jobs.update.nextRun()}`)
}
return
}
// is debug logAllEvents activated
const logAllEvents = this.homey.settings.get(this.variableMgmt.setting.logAllEvents) ?? false
// get event limit from settings or use the default
const eventLimit = this.homey.settings.get(this.variableMgmt.setting.eventLimit) || this.variableMgmt.setting.eventLimitDefault
const oldCalendarsUidsStorage = this.homey.settings.get(this.variableMgmt.storage.eventUids)
const oldCalendarsUids = hasData(oldCalendarsUidsStorage) ? JSON.parse(oldCalendarsUidsStorage) : []
this.log('getEvents: oldCalendarsUids --', oldCalendarsUids.length)
const calendarsEvents = []
const calendarsMetadata = []
// get ical events
this.log(`getEvents: Getting ${calendars.length} calendars in timezone '${this.getTimezone()}'`)
if (logAllEvents) {
this.log('getEvents: Debug - logAllEvents active')
}
const retrieveCalendarsStart = new Date()
for (let i = 0; i < calendars.length; i++) {
const { name } = calendars[i]
let { uri } = calendars[i]
if (uri === '') {
this.warn(`getEvents: Calendar '${name}' has empty uri. Skipping...`)
continue
}
if (!/(http|https|webcal):\/\/.+/gi.exec(uri)) {
this.warn(`getEvents: Uri for calendar '${name}' is invalid. Skipping...`)
calendars[i] = { name, uri, failed: `Uri for calendar '${name}' is invalid. Missing "http://", "https://" or "webcal://"` }
errors.push(calendars[i].failed)
this.homey.settings.set(this.variableMgmt.setting.icalUris, calendars)
this.warn(`getEvents: Added 'error' setting value to calendar '${name}' : ${calendars[i].failed}`)
await triggerSynchronizationError({ app: this, calendar: name, error: calendars[i].failed })
continue
}
if (/webcal:\/\//gi.exec(uri)) {
uri = uri.replace(/webcal:\/\//gi, 'https://')
this.log(`getEvents: Calendar '${name}': webcal:// found and replaced with https://`)
calendars[i] = { name, uri }
this.homey.settings.set(this.variableMgmt.setting.icalUris, calendars)
}
this.log(`getEvents: Getting events (${eventLimit.value} ${eventLimit.type} ahead) for calendar`, name, uri)
const retrieveCalendarStart = new Date()
let data
try {
data = await ical.fromURL(uri)
} catch (error) {
const { fallbackUri } = getFallbackUri(this, uri)
const errorString = typeof error === 'object' ? error.message : error
this.logError(`getEvents: Failed to get events for calendar '${name}' with uri '${uri}' :`, error)
try {
this.warn(`getEvents: Getting events (${eventLimit.value} ${eventLimit.type} ahead) for calendar`, name, 'with fallback uri', fallbackUri)
data = await ical.fromURL(uri)
} catch (innerError) {
const fallbackErrorString = typeof innerError === 'object' ? innerError.message : innerError
this.logError(`getEvents: Failed to get events for calendar '${name}' with fallback uri '${fallbackUri}' :`, innerError)
errors.push(`Failed to get events for calendar '${name}' with uri '${uri}' (${errorString}) and '${fallbackUri}' (${fallbackErrorString})`)
await triggerSynchronizationError({ app: this, calendar: name, error: innerError })
calendarsMetadata.push({ name, eventCount: 0, lastFailedSync: moment({ timezone: this.getTimezone() }) })
// set a failed setting value to show an error message on settings page
calendars[i] = { name, uri, failed: fallbackErrorString }
this.homey.settings.set(this.variableMgmt.setting.icalUris, calendars)
this.warn(`getEvents: Added 'error' setting value to calendar '${name}'`)
}
}
if (typeof data === 'object') {
// remove failed setting if it exists for calendar
if (calendars[i].failed) {
calendars[i] = { name, uri }
this.homey.settings.set(this.variableMgmt.setting.icalUris, calendars)
this.log(`getEvents: Removed 'error' setting value from calendar '${name}'`)
}
const retrieveCalendarEnd = new Date()
try {
this.log(`getEvents: Events for calendar '${name}' retrieved. Total event count for calendar: ${Object.keys(data).length}. Time used: ${this.getWorkTime(retrieveCalendarStart, retrieveCalendarEnd)}`)
let activeEvents = getActiveEvents({ timezone: this.getTimezone(), data, eventLimit, calendarName: name, app: this, logAllEvents })
this.log(`getEvents: Active events for calendar '${name}' updated. Event count: ${activeEvents.length}. Time used: ${this.getWorkTime(retrieveCalendarEnd, new Date())}`)
calendarsEvents.push({ name, events: activeEvents })
calendarsMetadata.push({ name, eventCount: activeEvents.length, lastSuccessfullSync: moment({ timezone: this.getTimezone() }) })
activeEvents = null
} catch (error) {
const errorString = typeof error === 'object' ? error.message : error
this.logError(`getEvents: Failed to get active events for calendar '${name}'. Time used: ${this.getWorkTime(retrieveCalendarEnd, new Date())} :`, error)
errors.push(`Failed to get active events for calendar '${name}' : ${errorString})`)
await triggerSynchronizationError({ app: this, calendar: name, error })
calendarsMetadata.push({ name, eventCount: 0, lastFailedSync: moment({ timezone: this.getTimezone() }) })
// set a failed setting value to show an error message on settings page
calendars[i] = { name, uri, failed: errorString }
this.homey.settings.set(this.variableMgmt.setting.icalUris, calendars)
this.warn(`getEvents: Added 'error' setting value to calendar '${name}'`)
}
} else {
this.warn(`getEvents: Calendar '${name}' not reachable! Giving up... Time used: ${this.getWorkTime(retrieveCalendarStart, new Date())}`)
}
data = null
}
try {
if (this.variableMgmt.calendars && this.variableMgmt.calendars.length > 0 && calendarsEvents.length > 0) {
const updatedCalendars = filterUpdatedCalendars({ app: this, oldCalendars: this.variableMgmt.calendars, newCalendars: calendarsEvents })
await triggerChangedCalendars({ app: this, calendars: updatedCalendars })
}
} catch (error) {
const errorString = typeof error === 'object' ? error.message : error
this.logError('getEvents: Failed to filter/trigger changed calendars:', errorString)
await triggerSynchronizationError({ app: this, calendar: 'Changed calendars', error })
}
const newCalendarsUids = getEventUids(calendarsEvents)
this.log('getEvents: newCalendarsUids --', newCalendarsUids.length)
const newlyAddedEvents = getNewEvents({ timezone: this.getTimezone(), oldCalendarsUids, newCalendarsUids, calendarsEvents, app: this })
this.log('getEvents: newlyAddedEvents --', newlyAddedEvents.length)
for await (const event of newlyAddedEvents) {
await triggerEvents({ timezone: this.getTimezone(), app: this, event: { calendarName: event.calendarName, event, triggerId: 'event_added' } })
await triggerEvents({ timezone: this.getTimezone(), app: this, event: { calendarName: event.calendarName, event, triggerId: 'event_added_calendar', state: { calendarName: event.calendarName } } })
}
this.homey.settings.set(this.variableMgmt.storage.eventUids, JSON.stringify(newCalendarsUids))
// get local events (only the ones that are not started yet or is ongoing)
const localEventsJSON = this.homey.settings.get(this.variableMgmt.storage.localEvents)
const localEvents = localEventsJSON ? JSON.parse(localEventsJSON) : []
this.variableMgmt.localEvents = getLocalActiveEvents({ app: this, eventLimit, events: localEvents, timezone: this.getTimezone(), logAllEvents })
// save local events returned
saveLocalEvents(this, this.variableMgmt.localEvents)
// add local events to the correct calendar
this.variableMgmt.localEvents.forEach((event) => {
const calendar = calendarsEvents.find((c) => c.name === event.calendar)
if (calendar) {
calendar.events.push(event)
}
})
this.variableMgmt.calendars = calendarsEvents
sortCalendarsEvents(this.variableMgmt.calendars)
const allEventCount = this.variableMgmt.calendars.reduce((curr, acu) => {
curr += acu.events.length
return curr
}, 0)
this.log(`getEvents: All events count: ${allEventCount}. Time used: ${this.getWorkTime(retrieveCalendarsStart, new Date())}`)
this.homey.settings.set(this.variableMgmt.storage.calendarsMetadata, JSON.stringify(calendarsMetadata))
if (reregisterCalendarTokens) {
// unregister calendar tokens
if (this.variableMgmt.calendarTokens.length > 0) {
this.log('getEvents: Calendar tokens starting to flush')
await Promise.all(this.variableMgmt.calendarTokens.map(async (tokenId) => {
try {
const token = this.homey.flow.getToken(tokenId)
if (token) {
this.log(`getEvents: Calendar token '${token.id}' starting to flush`)
return token.unregister()
}
this.warn(`getEvents: Calendar token '${tokenId}' not found`)
return Promise.resolve()
} catch (ex) {
this.logError(`getEvents: Failed to get calendar token '${tokenId}'`, ex)
}
}))
this.variableMgmt.calendarTokens = []
this.log('getEvents: Calendar tokens flushed')
}
// unregister next event with tokens
if (Array.isArray(this.variableMgmt.nextEventWithTokens) && this.variableMgmt.nextEventWithTokens.length > 0) {
this.log('getEvents: Next event with tokens starting to flush')
await Promise.all(this.variableMgmt.nextEventWithTokens.map(async (tokenId) => {
try {
const token = this.homey.flow.getToken(tokenId)
if (token) {
this.log(`getEvents: Next event with token '${tokenId}' starting to flush`)
return token.unregister()
}
this.warn(`getEvents: Next event with token '${tokenId}' not found`)
return Promise.resolve()
} catch (ex) {
this.logError(`getEvents: Failed to get next event with token '${tokenId}'`, ex)
}
}))
this.variableMgmt.nextEventWithTokens = []
this.log('getEvents: Next event with tokens flushed')
}
// get settings for adding extra tokens
const nextEventTokensPerCalendar = this.homey.settings.get(this.variableMgmt.setting.nextEventTokensPerCalendar)
// register calendar tokens
if (this.variableMgmt.calendars.length > 0) {
await Promise.all(this.variableMgmt.calendars.map(async (calendar) => {
// register todays and tomorrow's events pr calendar
generateTokens({ app: this, variableMgmt: this.variableMgmt, calendarName: calendar.name }).map(async ({ id, type, title }) => {
try {
const token = await this.homey.flow.createToken(id, { type, title, value: '' })
if (token) {
this.variableMgmt.calendarTokens.push(id)
this.log(`getEvents: Created calendar token '${id}'`)
return Promise.resolve()
}
this.warn(`getEvents: Calendar token '${id}' not created`)
} catch (ex) {
this.logError(`getEvents: Failed to create calendar token '${id}'`, ex)
}
return Promise.resolve()
})
// register next event title, next event start, next event start time, next event end date and next event end time pr calendar
if (nextEventTokensPerCalendar) {
generatePerCalendarTokens({ app: this, variableMgmt: this.variableMgmt, calendarName: calendar.name }).map(async ({ id, type, title }) => {
try {
const token = await this.homey.flow.createToken(id, { type, title, value: '' })
if (token) {
this.variableMgmt.calendarTokens.push(id)
this.log(`getEvents: Created per calendar token '${id}'`)
return Promise.resolve()
}
this.warn(`getEvents: Per calendar token '${id}' not created`)
} catch (ex) {
this.logError(`getEvents: Failed to create per calendar token '${id}'`, ex)
}
return Promise.resolve()
})
}
}))
// register next event with text tokens
this.variableMgmt.nextEventWithTokens = []
for await (const { id, type, title } of generateNextEventTokens({ app: this, variableMgmt: this.variableMgmt })) {
try {
const token = await this.homey.flow.createToken(id, { type, title, value: '' })
if (token) {
this.variableMgmt.nextEventWithTokens.push(id)
this.log(`getEvents: Created next event with token '${id}'`)
} else {
this.warn(`getEvents: Failed to create next event with token '${id}'`)
}
} catch (ex) {
this.logError(`getEvents: Failed to create next event with token '${id}'`, ex)
}
}
}
}
this.isGettingEvents = false
this.gettingEventsLastRun = new Date()
if (this.jobs && this.jobs.update && typeof this.jobs.update.nextRun === 'function') {
this.log(`getEvents: Next update in UTC: ${this.jobs.update.nextRun()}`)
}
if (errors.length > 0) {
return errors
}
}
startJobs (type) {
const updateFunc = () => {
if (this.isGettingEvents) {
this.warn('startJobs/update: Wont update calendars from this job since getEvents is already running')
return
}
if (this.gettingEventsLastRun && ((new Date() - this.gettingEventsLastRun) / 1000 / 60) < 5) {
this.warn('startJobs/update: Wont update calendars from this job since there\'s less than 5 minutes since getEvents was last executed:', this.gettingEventsLastRun)
return
}
this.log('startJobs/update: Updating calendars without reregistering tokens')
this.getEvents()
}
const interval = this.homey.settings.get(this.variableMgmt.setting.syncInterval)
if (typeof type !== 'string') {
if (this.jobs) {
Object.getOwnPropertyNames(this.jobs).forEach((prop) => {
if (typeof this.jobs[prop].stop === 'function') {
this.log(`startJobs: Job '${prop}' will be stopped`)
this.jobs[prop].stop()
}
})
}
this.jobs = {}
// trigger events every 1th minute
this.jobs.trigger = addJob('*/1 * * * *', async () => {
let now = moment({ timezone: this.getTimezone() })
if (now.get('hours') === 0 && now.get('minutes') === 0) {
resetTodayHitCount(this)
}
now = null
if (this.isGettingEvents) {
this.warn('startJobs/trigger: Wont update tokens and trigger events since getEvents is running. Will update/trigger in one minute')
return
}
if (this.variableMgmt.calendars && this.variableMgmt.calendars.length > 0) {
this.log('startJobs/trigger: Updating tokens and triggering events')
await updateTokens({ timezone: this.getTimezone(), app: this })
await triggerEvents({ timezone: this.getTimezone(), app: this })
} else if (this.variableMgmt.calendars && this.variableMgmt.calendars.length === 0) {
this.warn('startJobs/trigger: Wont update tokens and trigger events since theres no calendars. Calendars:', this.variableMgmt.calendars)
}
})
// calendar update by cron syntax
if (!interval.auto) {
this.log('startJobs: Auto update is disabled. Synchronization will only be performed by flowcard!')
return
}
if (!isValidCron(interval.cron)) {
this.logError(`startJobs: Auto update is disabled. Invalid cron value specified in settings: '${interval.cron}'`)
triggerSynchronizationError({ app: this, calendar: 'cron syntax', error: `Invalid cron value specified in settings: '${interval.cron}'` })
interval.error = `Invalid cron value specified in settings: '${interval.cron}'`
this.homey.settings.set(this.variableMgmt.setting.syncInterval, interval)
return
} else if (typeof interval.error === 'string') {
delete interval.error
this.homey.settings.set(this.variableMgmt.setting.syncInterval, interval)
}
this.jobs.update = addJob(interval.cron, updateFunc)
this.log(`startJobs: Auto update enabled with cron value '${interval.cron}'. Next update in UTC: ${this.jobs.update.nextRun()}`)
return
}
if (type === 'update') {
if (this.jobs && this.jobs.update && typeof this.jobs.update.stop === 'function') {
this.jobs.update.stop()
}
if (!interval.auto) {
this.log('startJobs(update): Auto update is disabled. Synchronization will only be performed by flowcard!')
delete this.jobs.update
return
}
if (!isValidCron(interval.cron)) {
this.logError(`startJobs(update): Auto update is disabled. Invalid cron value specified in settings: '${interval.cron}'`)
delete this.jobs.update
triggerSynchronizationError({ app: this, calendar: 'cron syntax', error: `Invalid cron value specified in settings: '${interval.cron}'` })
interval.error = `Invalid cron value specified in settings: '${interval.cron}'`
this.homey.settings.set(this.variableMgmt.setting.syncInterval, interval)
return
} else if (typeof interval.error === 'string') {
delete interval.error
this.homey.settings.set(this.variableMgmt.setting.syncInterval, interval)
}
this.jobs.update = addJob(interval.cron, updateFunc)
this.log(`startJobs(update): Auto update enabled with cron value '${interval.cron}'. Next update in UTC: ${this.jobs.update.nextRun()}`)
}
}
/**
* onUninit method is called when your app is destroyed
*/
async onUninit () {
if (typeof this._unload !== 'function') {
this.warn('onUninit -- this._unload is not a function')
return
}
this.log('onUninit -- calling this._unload')
this._unload('onUninit')
}
}
module.exports = IcalCalendar