Options
All
  • Public
  • Public/Protected
  • All
Menu

Usually you get an ICalAlarm object like this:

import ical from 'ical-generator';
const calendar = ical();
const event = calendar.createEvent();
const alarm = event.createAlarm();

You can also use the ICalAlarm object directly:

import ical, {ICalAlarm} from 'ical-generator';
const alarm = new ICalAlarm();
event.alarms([alarm]);

Hierarchy

  • ICalAlarm

Index

Constructors

constructor

Methods

attach

  • attach(): null | { mime: null | string; uri: string }
  • attach(attachment: null | string | { mime?: null | string; uri: string }): ICalAlarm
  • Get Attachment

    since

    0.2.1

    Returns null | { mime: null | string; uri: string }

  • 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'
        }
    });
    
    since

    0.2.1

    Parameters

    • attachment: null | string | { mime?: null | string; uri: string }

    Returns ICalAlarm

description

  • description(): null | string
  • description(description: null | string): ICalAlarm
  • Get the alarm description. Used to set the alarm message if alarm type is display. Defaults to the event's summary.

    since

    0.2.1

    Returns null | string

  • Set the alarm description. Used to set the alarm message if alarm type is display. Defaults to the event's summary.

    since

    0.2.1

    Parameters

    • description: null | string

    Returns ICalAlarm

interval

  • interval(interval: null | number): ICalAlarm
  • interval(): null | number
  • Get Repeat Interval

    since

    0.2.1

    Parameters

    • interval: null | number

    Returns ICalAlarm

  • Set Repeat Interval

    const cal = ical();
    const event = cal.createEvent();
    
    // repeat the alarm 4 times every 5 minutes…
    cal.createAlarm({
        repeat: 4,
        interval: 300
    });
    
    since

    0.2.1

    Returns null | number

repeat

  • repeat(): null | number
  • repeat(repeat: null | number): ICalAlarm
  • Get Alarm Repetitions

    since

    0.2.1

    Returns null | number

  • 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: 4,
        interval: 300
    });
    
    since

    0.2.1

    Parameters

    • repeat: null | number

    Returns ICalAlarm

toJSON

  • 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.

    since

    0.2.4

    Returns ICalAlarmJSONData

toString

  • toString(): string
  • Return generated event as a string.

    const alarm = event.createAlarm();
    console.log(alarm.toString()); // → BEGIN:VALARM…
    

    Returns string

trigger

  • 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.

    since

    0.2.1

    Returns null | number | ICalDateTimeValue

  • 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.

    since

    0.2.1

    Parameters

    Returns ICalAlarm

triggerAfter

  • 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.

    since

    0.2.1

    Returns null | number | ICalDateTimeValue

  • 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.

    since

    0.2.1

    Parameters

    Returns ICalAlarm

triggerBefore

  • 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.

    since

    0.2.1

    alias

    trigger

    Parameters

    Returns ICalAlarm

  • 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.

    since

    0.2.1

    alias

    trigger

    Returns null | number | ICalDateTimeValue

type

x

  • x(keyOrArray: { key: string; value: string }[] | [string, string][] | Record<string, string>): ICalAlarm
  • x(keyOrArray: string, value: string): ICalAlarm
  • x(): { key: string; value: string }[]
  • 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!"
    });
    
    since

    1.9.0

    Parameters

    • keyOrArray: { key: string; value: string }[] | [string, string][] | Record<string, string>

    Returns ICalAlarm

  • 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!");
    
    since

    1.9.0

    Parameters

    • keyOrArray: string
    • value: string

    Returns ICalAlarm

  • Get all custom X-* attributes.

    since

    1.9.0

    Returns { key: string; value: string }[]

Legend

  • Constructor
  • Method
  • Property

Generated using TypeDoc