Class Component

Wraps a jCal component, adding convenience methods to add, remove and update subcomponents and properties.

Hierarchy

  • Component

Constructors

  • Creates a new ICAL.Component instance.

    Parameters

    • jCal: string | ParseComponent | [string, Record<string, string>, ...string[]]

      Raw jCal component data OR name of new

    • Optional parent: Component

      Parent component to associate

    Returns Component

Properties

_components?: Component[]
_hydratedComponentCount: number = 0

The same count as for _hydratedPropertyCount, but for subcomponents

_hydratedPropertyCount: number = 0

Hydrated properties are inserted into the _properties array at the same position as in the jCal array, so it is possible that the array contains undefined values for unhydrdated properties. To avoid iterating the array when checking if all properties have been hydrated, we save the count here.

_properties?: Property[]
_timezoneCache: null | Map<string, Timezone> = null

A cache of hydrated time zone objects which may be used by consumers, keyed by time zone ID.

jCal: any[]
parent: null | Component

Accessors

  • get name(): any
  • The name of this component

    Returns any

Methods

  • Parameters

    • jCalIndex: number
    • cache: "_components" | "_properties"
    • Optional name: string

    Returns void

  • Parameters

    • jCalIndex: number
    • cache: "_components" | "_properties"
    • nameOrObject: string | Component | Property

    Returns boolean

  • Parameters

    Returns void

  • Helper method to add a property with a value to the component.

    Parameters

    • name: string

      Property name to add

    • value: null | object

      Property value

    Returns Property

    The created property

  • Get all properties in the component, optionally filtered by name.

    Parameters

    • Optional name: string

      Lowercase property name

    Returns Property[]

    List of properties

  • Finds all sub components, optionally filtering by name.

    Parameters

    • Optional name: string

      Optional name to filter by

    Returns Component[]

    The found sub components

  • Finds the first property, optionally with the given name.

    Parameters

    • Optional name: string

      Lowercase property name

    Returns null | Property

    The found property

  • Returns first property's value, if available.

    Parameters

    • Optional name: string

      Lowercase property name

    Returns any

    The found property value.

  • Finds first sub component, optionally filtered by name.

    Parameters

    • Optional name: string

      Optional name to filter by

    Returns null | Component

    The found subcomponent

  • Retrieve a time zone definition from the component tree, if any is present. If the tree contains no time zone definitions or the TZID cannot be matched, returns null.

    Parameters

    • tzid: string

      The ID of the time zone to retrieve

    Returns null | Timezone

    The time zone corresponding to the ID, or null

  • Returns true when a named property exists.

    Parameters

    • name: string

      The property name

    Returns boolean

    True, when property is found

  • Removes all properties associated with this component, optionally filtered by name.

    Parameters

    • Optional name: string

      Lowercase property name

    Returns void

    True, when deleted

  • Removes all components or (if given) all components by a particular name.

    Parameters

    • Optional name: string

      Lowercase component name

    Returns void

  • Removes a single property by name or the instance of the specific property.

    Parameters

    • nameOrProp: string | Property

      Property name or instance to remove

    Returns boolean

    True, when deleted

  • Removes a single component by name or the instance of a specific component.

    Parameters

    • nameOrComp: string | Component

      Name of component, or component

    Returns boolean

    True when comp is removed

  • Returns the Object representation of this component. The returned object is a live jCal object and should be cloned if modified.

    Returns object

  • The string representation of this component.

    Returns string

  • Helper method that will update or create a property of the given name and sets its value. If multiple properties with the given name exist, only the first is updated.

    Parameters

    • name: string

      Property name to update

    • value: null | object

      Property value

    Returns Property

    The created property

Generated using TypeDoc