Class: CalendarScheduler

CalendarScheduler(scheduleIntervalSecs, lookAheadSecsopt)

The CalendarScheduler is a Scheduler for Calendars that provide Events from ical.js. It periodically checks all the calendars added to it and schedules their events so that their are triggered. The periodicity as well as the look-ahead are configurable.

Constructor

new CalendarScheduler(scheduleIntervalSecs, lookAheadSecsopt)

Parameters:
Name Type Attributes Description
scheduleIntervalSecs number an interval, in seconds, to check all calendars and schedule their events (regardless of Calendar's update- interval). Since a calendar is usually not required to be accurate to the millisecond, the lowests allowed value is five (5) seconds. The recommen- ded value is 30 seconds and there is no upper limit.
lookAheadSecs number <optional>
Optional. Defaults to twice the amount of scheduleIntervalSecs (60/one minute). The amount of seconds to look ahead when scheduling all Calendars. This number must be equal to or larger than scheduleIntervalSecs; otherwise, events will be missed.
Author:
Source:

Members

(static) oneDayInSecs

Source:

(static) oneHourInSecs

Source:

(static) oneMinuteInSecs

Source:

(static) oneWeekInSecs

Source:

_lookAheadSecs :number

Type:
  • number
Source:

_observableScheduleError :Observable.<CalendarError>

Type:
Source:

_scheduledCalendarUpdates :Object.<string, number>

Type:
  • Object.<string, number>
Source:

_scheduledEvents :Map.<Calendar, Array.<{eventId: string, timeout: NodeJS.Timer}>>

Type:
  • Map.<Calendar, Array.<{eventId: string, timeout: NodeJS.Timer}>>
Source:

_scheduleIntervalSecs :number

Type:
  • number
Source:

_schedulerInterval :number

Type:
  • number
Source:

calendars :Array.<Calendar>

Type:
Source:

lookAheadSecs

Source:

lookAheadSecs

Source:

observable

Returns an Rx.Observable that will emit events whenever they are reported to its subscribers.
Source:

observableScheduleError

This Observable will emit all errors as emitted by the Calendars. The corresponding events can be observed using symbolScheduleError.
Source:
See:
  • {symbolScheduleError}

scheduleIntervalSecs

Source:

scheduleIntervalSecs

Source:

Methods

_isCalendar(calendar) → {boolean}

Parameters:
Name Type Description
calendar Calendar
Source:
Returns:
true, iff the given calendar is an instance of Calendar.
Type
boolean

_scheduleCalendar(calendar)

Parameters:
Name Type Description
calendar Calendar
Source:

_unscheduleCalendar(calendar)

Parameters:
Name Type Description
calendar Calendar
Source:

(async) _updateCalendar(calendar) → {Promise.<void>}

Parameters:
Name Type Description
calendar Calendar
Source:
Returns:
Type
Promise.<void>

(async) addCalendar(calendar, waitForUpdate) → {Promise.<this>}

Parameters:
Name Type Default Description
calendar Calendar
waitForUpdate boolean true if true, will wait to resolve the promise until the added calendar has been updated.
Source:
Returns:
Type
Promise.<this>

addSchedule(schedule) → {this}

Calls addCalendar(schedule, waitForUpdate = false) so that the call behaves synchronously.
Parameters:
Name Type Description
schedule Calendar
Source:
Returns:
Type
this

getObservableForSchedule(calendar) → {Observable.<CalendarEventSimple>}

Returns an Observable for the designated schedule (here: the calendar).
Parameters:
Name Type Description
calendar Schedule | Calendar Must be an instance of Calendar.
Source:
Returns:
Type
Observable.<CalendarEventSimple>

hasCalendar(calendar)

Parameters:
Name Type Description
calendar Calendar
Source:

hasSchedule(schedule) → {boolean}

Calls hasCalendar() with the given Schedule.
Parameters:
Name Type Description
schedule Calendar
Source:
Returns:
Type
boolean

(generator) preliminaryEvents(afteropt, beforeopt) → {IterableIterator.<PreliminaryScheduleEvent.<Calendar, iCalTime>>}

Parameters:
Name Type Attributes Description
after Date <optional>
before Date <optional>
Source:
Returns:
Type
IterableIterator.<PreliminaryScheduleEvent.<Calendar, iCalTime>>

removeAllSchedules() → {Array.<Calendar>}

Removes all Calendars from this scheduler. This will lead to all Calendars being un-scheduled.
Source:
Returns:
Type
Array.<Calendar>

removeCalendar(calendar) → {this}

Parameters:
Name Type Description
calendar Calendar
Source:
Returns:
Type
this

removeSchedule(schedule) → {this}

Calls removeCalendar() with the given Schedule.
Parameters:
Name Type Description
schedule Calendar
Source:
Returns:
Type
this