Constructor of ICalAttendee. The event reference is required to query the calendar's timezone and summary when required.
Alarm Data
Reference to ICalEvent object
Get Attachment
Set Alarm attachment. Used to set the alarm sound if alarm type is audio. Defaults to "Basso".
const cal = ical();
const event = cal.createEvent();
event.createAlarm({
attach: 'https://example.com/notification.aud'
});
// OR
event.createAlarm({
attach: {
uri: 'https://example.com/notification.aud',
mime: 'audio/basic'
}
});
Get all attendees
Add multiple attendees to your event
Creates a new ICalAttendee and returns it. Use options to prefill the attendee's attributes. Calling this method without options will create an empty attendee.
Get the alarm description. Used to set the alarm message
if alarm type is display
. If the alarm type is email
, it's
used to set the email body. Defaults to the event's summary.
Set the alarm description. Used to set the alarm message
if alarm type is display
. If the alarm type is email
, it's
used to set the email body. Defaults to the event's summary.
Get to which time alarm trigger relates to.
Can be either START
or END
. If the value is
START
the alarm is triggerd relative to the event start time.
If the value is END
the alarm is triggerd relative to the event end time
Use this method to set to which time alarm trigger relates to.
Works only if trigger is a number
const cal = ical();
const event = cal.createEvent();
const alarm = cal.createAlarm();
alarm.trigger(600); // -> 10 minutes before event starts
alarm.relatesTo('START'); // -> 10 minutes before event starts
alarm.relatesTo('END'); // -> 10 minutes before event ends
alarm.trigger(-600); // -> 10 minutes after event starts
alarm.relatesTo('START'); // -> 10 minutes after event starts
alarm.relatesTo('END'); // -> 10 minutes after event ends
Get Alarm Repetitions
Set Alarm Repetitions. Use this to repeat the alarm.
const cal = ical();
const event = cal.createEvent();
// repeat the alarm 4 times every 5 minutes…
cal.createAlarm({
repeat: {
times: 4,
interval: 300
}
});
Get the alarm summary. Used to set the email subject
if alarm type is email
. Defaults to the event's summary.
Set the alarm summary. Used to set the email subject if alarm type is display. Defaults to the event's summary.
Return a shallow copy of the alarm's options for JSON stringification. Third party objects like moment.js values are stringified as well. Can be used for persistence.
Get the trigger time for the alarm. Can either be a date and time value (ICalDateTimeValue) or a number, which will represent the seconds between alarm and event start. The number is negative, if the alarm is triggered after the event started.
Use this method to set the alarm time.
const cal = ical();
const event = cal.createEvent();
const alarm = cal.createAlarm();
alarm.trigger(600); // -> 10 minutes before event starts
alarm.trigger(new Date()); // -> now
You can use any supported date object, see readme for details about supported values and timezone handling.
Get the trigger time for the alarm. Can either be a date and time value (ICalDateTimeValue) or a number, which will represent the seconds between alarm and event start. The number is negative, if the alarm is triggered before the event started.
Use this method to set the alarm time. Unlike trigger
, this time
the alarm takes place after the event has started.
const cal = ical();
const event = cal.createEvent();
const alarm = cal.createAlarm();
alarm.trigger(600); // -> 10 minutes after event starts
You can use any supported date object, see readme for details about supported values and timezone handling.
Get the trigger time for the alarm. Can either be a date and time value (ICalDateTimeValue) or a number, which will represent the seconds between alarm and event start. The number is negative, if the alarm is triggered after the event started.
Use this method to set the alarm time.
const cal = ical();
const event = cal.createEvent();
const alarm = cal.createAlarm();
alarm.trigger(600); // -> 10 minutes before event starts
alarm.trigger(new Date()); // -> now
You can use any supported date object, see readme for details about supported values and timezone handling.
Get the alarm type
Set the alarm type. See ICalAlarmType for available status options.
Set X-* attributes. Woun't filter double attributes, which are also added by another method (e.g. type), so these attributes may be inserted twice.
alarm.x([
{
key: "X-MY-CUSTOM-ATTR",
value: "1337!"
}
]);
alarm.x([
["X-MY-CUSTOM-ATTR", "1337!"]
]);
alarm.x({
"X-MY-CUSTOM-ATTR": "1337!"
});
Set a X-* attribute. Woun't filter double attributes, which are also added by another method (e.g. type), so these attributes may be inserted twice.
alarm.x("X-MY-CUSTOM-ATTR", "1337!");
Get all custom X-* attributes.
Usually you get an ICalAlarm object like this:
You can also use the ICalAlarm object directly: